{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import dask.distributed\n",
    "import dask.dataframe as dd\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "\n",
    "import urllib, json\n",
    "import sklearn.neighbors"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Set up a local cluster of Dask Distributed"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "client = dask.distributed.Client()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Read historical bike data, print head and tail"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "df = dd.read_parquet('/bigdata/citibike.parquet')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>trip_duration</th>\n",
       "      <th>start_time</th>\n",
       "      <th>stop_time</th>\n",
       "      <th>start_station_id</th>\n",
       "      <th>start_station_name</th>\n",
       "      <th>start_station_latitude</th>\n",
       "      <th>start_station_longitude</th>\n",
       "      <th>end_station_id</th>\n",
       "      <th>end_station_name</th>\n",
       "      <th>end_station_latitude</th>\n",
       "      <th>end_station_longitude</th>\n",
       "      <th>bike_id</th>\n",
       "      <th>user_type</th>\n",
       "      <th>birth_year</th>\n",
       "      <th>gender</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>634</td>\n",
       "      <td>2013-07-01 00:00:00</td>\n",
       "      <td>2013-07-01 00:10:34</td>\n",
       "      <td>164</td>\n",
       "      <td>E 47 St &amp; 2 Ave</td>\n",
       "      <td>40.753231</td>\n",
       "      <td>-73.970322</td>\n",
       "      <td>504</td>\n",
       "      <td>1 Ave &amp; E 15 St</td>\n",
       "      <td>40.732220</td>\n",
       "      <td>-73.981659</td>\n",
       "      <td>16950</td>\n",
       "      <td>Customer</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1547</td>\n",
       "      <td>2013-07-01 00:00:02</td>\n",
       "      <td>2013-07-01 00:25:49</td>\n",
       "      <td>388</td>\n",
       "      <td>W 26 St &amp; 10 Ave</td>\n",
       "      <td>40.749718</td>\n",
       "      <td>-74.002953</td>\n",
       "      <td>459</td>\n",
       "      <td>W 20 St &amp; 11 Ave</td>\n",
       "      <td>40.746746</td>\n",
       "      <td>-74.007759</td>\n",
       "      <td>19816</td>\n",
       "      <td>Customer</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>178</td>\n",
       "      <td>2013-07-01 00:01:04</td>\n",
       "      <td>2013-07-01 00:04:02</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "      <td>40.730286</td>\n",
       "      <td>-73.990768</td>\n",
       "      <td>237</td>\n",
       "      <td>E 11 St &amp; 2 Ave</td>\n",
       "      <td>40.730473</td>\n",
       "      <td>-73.986725</td>\n",
       "      <td>14548</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1980.0</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1580</td>\n",
       "      <td>2013-07-01 00:01:06</td>\n",
       "      <td>2013-07-01 00:27:26</td>\n",
       "      <td>531</td>\n",
       "      <td>Forsyth St &amp; Broome St</td>\n",
       "      <td>40.718941</td>\n",
       "      <td>-73.992661</td>\n",
       "      <td>499</td>\n",
       "      <td>Broadway &amp; W 60 St</td>\n",
       "      <td>40.769154</td>\n",
       "      <td>-73.981918</td>\n",
       "      <td>16063</td>\n",
       "      <td>Customer</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>757</td>\n",
       "      <td>2013-07-01 00:01:10</td>\n",
       "      <td>2013-07-01 00:13:47</td>\n",
       "      <td>382</td>\n",
       "      <td>University Pl &amp; E 14 St</td>\n",
       "      <td>40.734928</td>\n",
       "      <td>-73.992004</td>\n",
       "      <td>410</td>\n",
       "      <td>Suffolk St &amp; Stanton St</td>\n",
       "      <td>40.720665</td>\n",
       "      <td>-73.985176</td>\n",
       "      <td>19213</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1986.0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   trip_duration          start_time           stop_time  start_station_id  \\\n",
       "0            634 2013-07-01 00:00:00 2013-07-01 00:10:34               164   \n",
       "1           1547 2013-07-01 00:00:02 2013-07-01 00:25:49               388   \n",
       "2            178 2013-07-01 00:01:04 2013-07-01 00:04:02               293   \n",
       "3           1580 2013-07-01 00:01:06 2013-07-01 00:27:26               531   \n",
       "4            757 2013-07-01 00:01:10 2013-07-01 00:13:47               382   \n",
       "\n",
       "        start_station_name  start_station_latitude  start_station_longitude  \\\n",
       "0          E 47 St & 2 Ave               40.753231               -73.970322   \n",
       "1         W 26 St & 10 Ave               40.749718               -74.002953   \n",
       "2    Lafayette St & E 8 St               40.730286               -73.990768   \n",
       "3   Forsyth St & Broome St               40.718941               -73.992661   \n",
       "4  University Pl & E 14 St               40.734928               -73.992004   \n",
       "\n",
       "   end_station_id         end_station_name  end_station_latitude  \\\n",
       "0             504          1 Ave & E 15 St             40.732220   \n",
       "1             459         W 20 St & 11 Ave             40.746746   \n",
       "2             237          E 11 St & 2 Ave             40.730473   \n",
       "3             499       Broadway & W 60 St             40.769154   \n",
       "4             410  Suffolk St & Stanton St             40.720665   \n",
       "\n",
       "   end_station_longitude  bike_id   user_type  birth_year  gender  \n",
       "0             -73.981659    16950    Customer         NaN       0  \n",
       "1             -74.007759    19816    Customer         NaN       0  \n",
       "2             -73.986725    14548  Subscriber      1980.0       2  \n",
       "3             -73.981918    16063    Customer         NaN       0  \n",
       "4             -73.985176    19213  Subscriber      1986.0       1  "
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>trip_duration</th>\n",
       "      <th>start_time</th>\n",
       "      <th>stop_time</th>\n",
       "      <th>start_station_id</th>\n",
       "      <th>start_station_name</th>\n",
       "      <th>start_station_latitude</th>\n",
       "      <th>start_station_longitude</th>\n",
       "      <th>end_station_id</th>\n",
       "      <th>end_station_name</th>\n",
       "      <th>end_station_latitude</th>\n",
       "      <th>end_station_longitude</th>\n",
       "      <th>bike_id</th>\n",
       "      <th>user_type</th>\n",
       "      <th>birth_year</th>\n",
       "      <th>gender</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>51474</th>\n",
       "      <td>441</td>\n",
       "      <td>2016-12-31 23:56:15</td>\n",
       "      <td>2017-01-01 00:03:36</td>\n",
       "      <td>284</td>\n",
       "      <td>Greenwich Ave &amp; 8 Ave</td>\n",
       "      <td>40.739017</td>\n",
       "      <td>-74.002640</td>\n",
       "      <td>336</td>\n",
       "      <td>Sullivan St &amp; Washington Sq</td>\n",
       "      <td>40.730476</td>\n",
       "      <td>-73.999062</td>\n",
       "      <td>16185</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1974.0</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>51475</th>\n",
       "      <td>1026</td>\n",
       "      <td>2016-12-31 23:56:19</td>\n",
       "      <td>2017-01-01 00:13:26</td>\n",
       "      <td>281</td>\n",
       "      <td>Grand Army Plaza &amp; Central Park S</td>\n",
       "      <td>40.764397</td>\n",
       "      <td>-73.973717</td>\n",
       "      <td>3143</td>\n",
       "      <td>5 Ave &amp; E 78 St</td>\n",
       "      <td>40.776829</td>\n",
       "      <td>-73.963890</td>\n",
       "      <td>18267</td>\n",
       "      <td>None</td>\n",
       "      <td>1983.0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>51476</th>\n",
       "      <td>1747</td>\n",
       "      <td>2016-12-31 23:56:35</td>\n",
       "      <td>2017-01-01 00:25:43</td>\n",
       "      <td>3424</td>\n",
       "      <td>E 106 St &amp; Lexington Ave</td>\n",
       "      <td>40.791977</td>\n",
       "      <td>-73.945992</td>\n",
       "      <td>3295</td>\n",
       "      <td>Central Park W &amp; W 96 St</td>\n",
       "      <td>40.791271</td>\n",
       "      <td>-73.964836</td>\n",
       "      <td>19899</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1970.0</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>51477</th>\n",
       "      <td>951</td>\n",
       "      <td>2016-12-31 23:59:31</td>\n",
       "      <td>2017-01-01 00:15:23</td>\n",
       "      <td>3158</td>\n",
       "      <td>W 63 St &amp; Broadway</td>\n",
       "      <td>40.771637</td>\n",
       "      <td>-73.982613</td>\n",
       "      <td>3169</td>\n",
       "      <td>Riverside Dr &amp; W 82 St</td>\n",
       "      <td>40.787209</td>\n",
       "      <td>-73.981277</td>\n",
       "      <td>16866</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1961.0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>51478</th>\n",
       "      <td>1322</td>\n",
       "      <td>2016-12-31 23:59:56</td>\n",
       "      <td>2017-01-01 00:21:58</td>\n",
       "      <td>3263</td>\n",
       "      <td>Cooper Square &amp; E 7 St</td>\n",
       "      <td>40.729237</td>\n",
       "      <td>-73.990868</td>\n",
       "      <td>498</td>\n",
       "      <td>Broadway &amp; W 32 St</td>\n",
       "      <td>40.748550</td>\n",
       "      <td>-73.988083</td>\n",
       "      <td>25793</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1985.0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       trip_duration          start_time           stop_time  \\\n",
       "51474            441 2016-12-31 23:56:15 2017-01-01 00:03:36   \n",
       "51475           1026 2016-12-31 23:56:19 2017-01-01 00:13:26   \n",
       "51476           1747 2016-12-31 23:56:35 2017-01-01 00:25:43   \n",
       "51477            951 2016-12-31 23:59:31 2017-01-01 00:15:23   \n",
       "51478           1322 2016-12-31 23:59:56 2017-01-01 00:21:58   \n",
       "\n",
       "       start_station_id                 start_station_name  \\\n",
       "51474               284              Greenwich Ave & 8 Ave   \n",
       "51475               281  Grand Army Plaza & Central Park S   \n",
       "51476              3424           E 106 St & Lexington Ave   \n",
       "51477              3158                 W 63 St & Broadway   \n",
       "51478              3263             Cooper Square & E 7 St   \n",
       "\n",
       "       start_station_latitude  start_station_longitude  end_station_id  \\\n",
       "51474               40.739017               -74.002640             336   \n",
       "51475               40.764397               -73.973717            3143   \n",
       "51476               40.791977               -73.945992            3295   \n",
       "51477               40.771637               -73.982613            3169   \n",
       "51478               40.729237               -73.990868             498   \n",
       "\n",
       "                  end_station_name  end_station_latitude  \\\n",
       "51474  Sullivan St & Washington Sq             40.730476   \n",
       "51475              5 Ave & E 78 St             40.776829   \n",
       "51476     Central Park W & W 96 St             40.791271   \n",
       "51477       Riverside Dr & W 82 St             40.787209   \n",
       "51478           Broadway & W 32 St             40.748550   \n",
       "\n",
       "       end_station_longitude  bike_id   user_type  birth_year  gender  \n",
       "51474             -73.999062    16185  Subscriber      1974.0       2  \n",
       "51475             -73.963890    18267        None      1983.0       1  \n",
       "51476             -73.964836    19899  Subscriber      1970.0       2  \n",
       "51477             -73.981277    16866  Subscriber      1961.0       1  \n",
       "51478             -73.988083    25793  Subscriber      1985.0       1  "
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.tail()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(36902025,)"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Count rows\n",
    "df.start_station_id.compute().shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# Select start and end columns as separate dataframes, \n",
    "# apply range checks on lats and lons to eliminate corrupted rows\n",
    "\n",
    "df_s = df[['start_station_id', 'start_station_name', \n",
    "           'start_station_latitude', 'start_station_longitude']]\n",
    "df_e = df[['end_station_id', 'end_station_name', \n",
    "           'end_station_latitude', 'end_station_longitude']]\n",
    "\n",
    "df_s = df_s[(df_s.start_station_latitude > 40.) & (df_s.start_station_latitude < 41.)]\n",
    "df_s = df_s[(df_s.start_station_longitude + 74.0 > -0.25) & (df_s.start_station_longitude + 74.0 < 0.25)]\n",
    "\n",
    "df_e = df_e[(df_e.end_station_latitude > 40.) & (df_e.end_station_latitude < 41.)]\n",
    "df_e = df_e[(df_e.end_station_longitude + 74.0 > -0.25) & (df_e.end_station_longitude + 74.0 < 0.25)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>start_station_id</th>\n",
       "      <th>start_station_name</th>\n",
       "      <th>start_station_latitude</th>\n",
       "      <th>start_station_longitude</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>164</td>\n",
       "      <td>E 47 St &amp; 2 Ave</td>\n",
       "      <td>40.753231</td>\n",
       "      <td>-73.970322</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>388</td>\n",
       "      <td>W 26 St &amp; 10 Ave</td>\n",
       "      <td>40.749718</td>\n",
       "      <td>-74.002953</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "      <td>40.730286</td>\n",
       "      <td>-73.990768</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>531</td>\n",
       "      <td>Forsyth St &amp; Broome St</td>\n",
       "      <td>40.718941</td>\n",
       "      <td>-73.992661</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>382</td>\n",
       "      <td>University Pl &amp; E 14 St</td>\n",
       "      <td>40.734928</td>\n",
       "      <td>-73.992004</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   start_station_id       start_station_name  start_station_latitude  \\\n",
       "0               164          E 47 St & 2 Ave               40.753231   \n",
       "1               388         W 26 St & 10 Ave               40.749718   \n",
       "2               293    Lafayette St & E 8 St               40.730286   \n",
       "3               531   Forsyth St & Broome St               40.718941   \n",
       "4               382  University Pl & E 14 St               40.734928   \n",
       "\n",
       "   start_station_longitude  \n",
       "0               -73.970322  \n",
       "1               -74.002953  \n",
       "2               -73.990768  \n",
       "3               -73.992661  \n",
       "4               -73.992004  "
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_s.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Take the start locations, end locations, calculate mean latitude and longitude, convert to pandas, rename columns and concatenate. Sort by id. This will contain duplicates due to numerical precision and due to actual duplication due to some other reason."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>name</th>\n",
       "      <th>lat</th>\n",
       "      <th>lon</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>72</td>\n",
       "      <td>W 52 St &amp; 11 Ave</td>\n",
       "      <td>40.767272</td>\n",
       "      <td>-73.993927</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>72</td>\n",
       "      <td>W 52 St &amp; 11 Ave</td>\n",
       "      <td>40.767273</td>\n",
       "      <td>-73.993926</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>79</td>\n",
       "      <td>Franklin St &amp; W Broadway</td>\n",
       "      <td>40.719118</td>\n",
       "      <td>-74.006668</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>79</td>\n",
       "      <td>Franklin St &amp; W Broadway</td>\n",
       "      <td>40.719117</td>\n",
       "      <td>-74.006671</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>82</td>\n",
       "      <td>St James Pl &amp; Pearl St</td>\n",
       "      <td>40.711174</td>\n",
       "      <td>-74.000166</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   id                      name        lat        lon\n",
       "0  72          W 52 St & 11 Ave  40.767272 -73.993927\n",
       "1  72          W 52 St & 11 Ave  40.767273 -73.993926\n",
       "2  79  Franklin St & W Broadway  40.719118 -74.006668\n",
       "3  79  Franklin St & W Broadway  40.719117 -74.006671\n",
       "4  82    St James Pl & Pearl St  40.711174 -74.000166"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a1 = df_s.groupby(['start_station_id', 'start_station_name']).mean().compute()\n",
    "a2 = df_e.groupby(['end_station_id', 'end_station_name']).mean().compute()\n",
    "\n",
    "a1.index = a1.index.rename(['id', 'name'])\n",
    "a1.columns = ['lat', 'lon']\n",
    "a2.index = a2.index.rename(['id', 'name'])\n",
    "a2.columns = ['lat', 'lon']\n",
    "\n",
    "trip_points = a1.append(a2).drop_duplicates().reset_index()\n",
    "trip_points = trip_points.sort_values('id').reset_index(drop=True)\n",
    "\n",
    "del a1, a2\n",
    "trip_points.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(1413, 4)"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "trip_points.shape"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Read current data state from web\n",
    "### This will be the authoritative list of bike stations and their coordinates"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# Uncomment these two lines to fetch latest file and rename it\n",
    "\n",
    "# !wget https://feeds.citibikenyc.com/stations/stations.json\n",
    "# !mv stations.json stations.`date +\"%Y.%m.%d.%H.%M\"`.json\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>altitude</th>\n",
       "      <th>availableBikes</th>\n",
       "      <th>availableDocks</th>\n",
       "      <th>city</th>\n",
       "      <th>id</th>\n",
       "      <th>landMark</th>\n",
       "      <th>lastCommunicationTime</th>\n",
       "      <th>latitude</th>\n",
       "      <th>location</th>\n",
       "      <th>longitude</th>\n",
       "      <th>postalCode</th>\n",
       "      <th>stAddress1</th>\n",
       "      <th>stAddress2</th>\n",
       "      <th>stationName</th>\n",
       "      <th>statusKey</th>\n",
       "      <th>statusValue</th>\n",
       "      <th>testStation</th>\n",
       "      <th>totalDocks</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td></td>\n",
       "      <td>20</td>\n",
       "      <td>16</td>\n",
       "      <td></td>\n",
       "      <td>72</td>\n",
       "      <td></td>\n",
       "      <td>2017-04-20 09:43:27 AM</td>\n",
       "      <td>40.767272</td>\n",
       "      <td></td>\n",
       "      <td>-73.993929</td>\n",
       "      <td></td>\n",
       "      <td>W 52 St &amp; 11 Ave</td>\n",
       "      <td></td>\n",
       "      <td>W 52 St &amp; 11 Ave</td>\n",
       "      <td>1</td>\n",
       "      <td>In Service</td>\n",
       "      <td>False</td>\n",
       "      <td>39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td></td>\n",
       "      <td>12</td>\n",
       "      <td>20</td>\n",
       "      <td></td>\n",
       "      <td>79</td>\n",
       "      <td></td>\n",
       "      <td>2017-04-20 09:42:54 AM</td>\n",
       "      <td>40.719116</td>\n",
       "      <td></td>\n",
       "      <td>-74.006667</td>\n",
       "      <td></td>\n",
       "      <td>Franklin St &amp; W Broadway</td>\n",
       "      <td></td>\n",
       "      <td>Franklin St &amp; W Broadway</td>\n",
       "      <td>1</td>\n",
       "      <td>In Service</td>\n",
       "      <td>False</td>\n",
       "      <td>33</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td></td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td></td>\n",
       "      <td>82</td>\n",
       "      <td></td>\n",
       "      <td>2017-04-13 12:05:52 PM</td>\n",
       "      <td>40.711174</td>\n",
       "      <td></td>\n",
       "      <td>-74.000165</td>\n",
       "      <td></td>\n",
       "      <td>St James Pl &amp; Pearl St</td>\n",
       "      <td></td>\n",
       "      <td>St James Pl &amp; Pearl St</td>\n",
       "      <td>3</td>\n",
       "      <td>Not In Service</td>\n",
       "      <td>False</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td></td>\n",
       "      <td>35</td>\n",
       "      <td>24</td>\n",
       "      <td></td>\n",
       "      <td>83</td>\n",
       "      <td></td>\n",
       "      <td>2017-04-20 09:42:19 AM</td>\n",
       "      <td>40.683826</td>\n",
       "      <td></td>\n",
       "      <td>-73.976323</td>\n",
       "      <td></td>\n",
       "      <td>Atlantic Ave &amp; Fort Greene Pl</td>\n",
       "      <td></td>\n",
       "      <td>Atlantic Ave &amp; Fort Greene Pl</td>\n",
       "      <td>1</td>\n",
       "      <td>In Service</td>\n",
       "      <td>False</td>\n",
       "      <td>62</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td></td>\n",
       "      <td>5</td>\n",
       "      <td>34</td>\n",
       "      <td></td>\n",
       "      <td>116</td>\n",
       "      <td></td>\n",
       "      <td>2017-04-20 09:42:20 AM</td>\n",
       "      <td>40.741776</td>\n",
       "      <td></td>\n",
       "      <td>-74.001497</td>\n",
       "      <td></td>\n",
       "      <td>W 17 St &amp; 8 Ave</td>\n",
       "      <td></td>\n",
       "      <td>W 17 St &amp; 8 Ave</td>\n",
       "      <td>1</td>\n",
       "      <td>In Service</td>\n",
       "      <td>False</td>\n",
       "      <td>39</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  altitude  availableBikes  availableDocks city   id landMark  \\\n",
       "0                       20              16        72            \n",
       "1                       12              20        79            \n",
       "2                        0               0        82            \n",
       "3                       35              24        83            \n",
       "4                        5              34       116            \n",
       "\n",
       "    lastCommunicationTime   latitude location  longitude postalCode  \\\n",
       "0  2017-04-20 09:43:27 AM  40.767272          -73.993929              \n",
       "1  2017-04-20 09:42:54 AM  40.719116          -74.006667              \n",
       "2  2017-04-13 12:05:52 PM  40.711174          -74.000165              \n",
       "3  2017-04-20 09:42:19 AM  40.683826          -73.976323              \n",
       "4  2017-04-20 09:42:20 AM  40.741776          -74.001497              \n",
       "\n",
       "                      stAddress1 stAddress2                    stationName  \\\n",
       "0               W 52 St & 11 Ave                          W 52 St & 11 Ave   \n",
       "1       Franklin St & W Broadway                  Franklin St & W Broadway   \n",
       "2         St James Pl & Pearl St                    St James Pl & Pearl St   \n",
       "3  Atlantic Ave & Fort Greene Pl             Atlantic Ave & Fort Greene Pl   \n",
       "4                W 17 St & 8 Ave                           W 17 St & 8 Ave   \n",
       "\n",
       "   statusKey     statusValue testStation  totalDocks  \n",
       "0          1      In Service       False          39  \n",
       "1          1      In Service       False          33  \n",
       "2          3  Not In Service       False           0  \n",
       "3          1      In Service       False          62  \n",
       "4          1      In Service       False          39  "
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_cur = pd.DataFrame(\n",
    "    json.loads(\n",
    "        open('stations.2017.04.20.09.43.json', 'r').read()\n",
    "    )['stationBeanList'])\n",
    "df_cur.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>stationName</th>\n",
       "      <th>latitude</th>\n",
       "      <th>longitude</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>72</td>\n",
       "      <td>W 52 St &amp; 11 Ave</td>\n",
       "      <td>40.767272</td>\n",
       "      <td>-73.993929</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>79</td>\n",
       "      <td>Franklin St &amp; W Broadway</td>\n",
       "      <td>40.719116</td>\n",
       "      <td>-74.006667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>82</td>\n",
       "      <td>St James Pl &amp; Pearl St</td>\n",
       "      <td>40.711174</td>\n",
       "      <td>-74.000165</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>83</td>\n",
       "      <td>Atlantic Ave &amp; Fort Greene Pl</td>\n",
       "      <td>40.683826</td>\n",
       "      <td>-73.976323</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>116</td>\n",
       "      <td>W 17 St &amp; 8 Ave</td>\n",
       "      <td>40.741776</td>\n",
       "      <td>-74.001497</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    id                    stationName   latitude  longitude\n",
       "0   72               W 52 St & 11 Ave  40.767272 -73.993929\n",
       "1   79       Franklin St & W Broadway  40.719116 -74.006667\n",
       "2   82         St James Pl & Pearl St  40.711174 -74.000165\n",
       "3   83  Atlantic Ave & Fort Greene Pl  40.683826 -73.976323\n",
       "4  116                W 17 St & 8 Ave  40.741776 -74.001497"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_cur = df_cur[['id', 'stationName', 'latitude', 'longitude']].sort_values('id')\n",
    "df_cur.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(664, 4)\n"
     ]
    }
   ],
   "source": [
    "# We see this has less than half the rows of trip_points\n",
    "print(df_cur.shape)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Do a spatial nearest neighbor search\n",
    "\n",
    "Construct a BallTree using the actual correct coordinate data from the JSON feed. Use that to lookup the locations in trip_points."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "bt = sklearn.neighbors.BallTree(df_cur[['latitude', 'longitude']].values, metric='euclidean')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.75813433619765225"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.cos(np.deg2rad(40.7))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "25 meters is approximately 0.000225˚ (not accounting for latitude)\n",
    "latitude will give a factor of  cos(41˚N)=0.76 at 41˚N. So we are really testing\n",
    "if the point lies within an ellipse with a radius of 25.6 meters in latitude\n",
    "and 25.6*0.75=19.2 meters in longitude. Should be good enough."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "25.018852499999998"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "0.000225*111194.9 # 111.1949 km per degree latitude "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "query_results = bt.query_radius(trip_points.ix[:, 2:], 0.000225)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The value of each row indicates the row in df_cur that matches each row in trip_points\n",
    "A zero for the first and second rows indicates that those rows in trip points match with\n",
    "the zeroth row in df_cur. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false,
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1413\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "[[0],\n",
       " [0],\n",
       " [1],\n",
       " [1],\n",
       " [2],\n",
       " [2],\n",
       " [3],\n",
       " [3],\n",
       " [4],\n",
       " [4],\n",
       " [5],\n",
       " [5],\n",
       " [6],\n",
       " [6],\n",
       " [7],\n",
       " [7],\n",
       " [8],\n",
       " [8],\n",
       " [9],\n",
       " [9],\n",
       " [10],\n",
       " [10],\n",
       " [11],\n",
       " [11],\n",
       " [12],\n",
       " [12],\n",
       " [13],\n",
       " [13],\n",
       " [14],\n",
       " [14],\n",
       " [15],\n",
       " [15],\n",
       " [16],\n",
       " [16],\n",
       " [17],\n",
       " [17],\n",
       " [18],\n",
       " [18],\n",
       " [],\n",
       " [],\n",
       " [19],\n",
       " [19],\n",
       " [20],\n",
       " [20],\n",
       " [21],\n",
       " [21],\n",
       " [22],\n",
       " [22],\n",
       " [23],\n",
       " [23],\n",
       " [24],\n",
       " [24],\n",
       " [25],\n",
       " [25],\n",
       " [26],\n",
       " [26],\n",
       " [27],\n",
       " [27],\n",
       " [28],\n",
       " [28],\n",
       " [],\n",
       " [],\n",
       " [29],\n",
       " [29],\n",
       " [30],\n",
       " [30],\n",
       " [31],\n",
       " [31],\n",
       " [32],\n",
       " [32],\n",
       " [33],\n",
       " [33],\n",
       " [34],\n",
       " [34],\n",
       " [651],\n",
       " [],\n",
       " [651],\n",
       " [],\n",
       " [35],\n",
       " [35],\n",
       " [36],\n",
       " [36],\n",
       " [37],\n",
       " [37],\n",
       " [38],\n",
       " [38],\n",
       " [39],\n",
       " [39],\n",
       " [],\n",
       " [40],\n",
       " [40],\n",
       " [],\n",
       " [],\n",
       " [],\n",
       " [42],\n",
       " [42],\n",
       " [43],\n",
       " [43],\n",
       " [44],\n",
       " [44],\n",
       " [45],\n",
       " [45],\n",
       " [46],\n",
       " [46],\n",
       " [],\n",
       " [],\n",
       " [],\n",
       " [],\n",
       " [47],\n",
       " [47],\n",
       " [48],\n",
       " [48],\n",
       " [49],\n",
       " [49],\n",
       " [50],\n",
       " [50],\n",
       " [],\n",
       " [],\n",
       " [51],\n",
       " [51],\n",
       " [52],\n",
       " [52],\n",
       " [53],\n",
       " [53],\n",
       " [54],\n",
       " [54],\n",
       " [55],\n",
       " [55],\n",
       " [56],\n",
       " [56],\n",
       " [],\n",
       " [],\n",
       " [57],\n",
       " [57],\n",
       " [58],\n",
       " [58],\n",
       " [59],\n",
       " [59],\n",
       " [60],\n",
       " [60],\n",
       " [61],\n",
       " [61],\n",
       " [62],\n",
       " [62],\n",
       " [],\n",
       " [],\n",
       " [63],\n",
       " [63],\n",
       " [64],\n",
       " [64],\n",
       " [65],\n",
       " [65],\n",
       " [66],\n",
       " [66],\n",
       " [],\n",
       " [67],\n",
       " [67],\n",
       " [67],\n",
       " [67],\n",
       " [],\n",
       " [68],\n",
       " [68],\n",
       " [69],\n",
       " [69],\n",
       " [],\n",
       " [],\n",
       " [71],\n",
       " [71],\n",
       " [72],\n",
       " [72],\n",
       " [73],\n",
       " [73],\n",
       " [],\n",
       " [],\n",
       " [74],\n",
       " [74],\n",
       " [],\n",
       " [],\n",
       " [],\n",
       " [],\n",
       " [76],\n",
       " [76],\n",
       " [77],\n",
       " [77],\n",
       " [78],\n",
       " [78],\n",
       " [],\n",
       " [],\n",
       " [],\n",
       " [],\n",
       " [],\n",
       " [],\n",
       " [79],\n",
       " [79],\n",
       " [80],\n",
       " [80],\n",
       " [81],\n",
       " [81],\n",
       " [82],\n",
       " [82],\n",
       " [83],\n",
       " [83],\n",
       " [84],\n",
       " [84],\n",
       " [85],\n",
       " [85],\n",
       " [86],\n",
       " [86],\n",
       " [87],\n",
       " [87],\n",
       " [88],\n",
       " [88],\n",
       " [89],\n",
       " [89],\n",
       " [90],\n",
       " [90],\n",
       " [90],\n",
       " [90],\n",
       " [91],\n",
       " [91],\n",
       " [92],\n",
       " [92],\n",
       " [],\n",
       " [],\n",
       " [93],\n",
       " [93],\n",
       " [94],\n",
       " [94],\n",
       " [95],\n",
       " [95],\n",
       " [],\n",
       " [],\n",
       " [96],\n",
       " [],\n",
       " [],\n",
       " [96],\n",
       " [],\n",
       " [97],\n",
       " [97],\n",
       " [],\n",
       " [98],\n",
       " [98],\n",
       " [99],\n",
       " [99],\n",
       " [100],\n",
       " [100],\n",
       " [101],\n",
       " [101],\n",
       " [102],\n",
       " [102],\n",
       " [103],\n",
       " [103],\n",
       " [104],\n",
       " [104],\n",
       " [105],\n",
       " [105],\n",
       " [],\n",
       " [],\n",
       " [],\n",
       " [],\n",
       " [106],\n",
       " [106],\n",
       " [107],\n",
       " [107],\n",
       " [108],\n",
       " [108],\n",
       " [109],\n",
       " [109],\n",
       " [110],\n",
       " [110],\n",
       " [111],\n",
       " [111],\n",
       " [112],\n",
       " [112],\n",
       " [113],\n",
       " [113],\n",
       " [114],\n",
       " [114],\n",
       " [115],\n",
       " [115],\n",
       " [116],\n",
       " [116],\n",
       " [117],\n",
       " [117],\n",
       " [118],\n",
       " [118],\n",
       " [119],\n",
       " [119],\n",
       " [120],\n",
       " [120],\n",
       " [],\n",
       " [121],\n",
       " [121],\n",
       " [],\n",
       " [122],\n",
       " [122],\n",
       " [123],\n",
       " [123],\n",
       " [124],\n",
       " [124],\n",
       " [125],\n",
       " [125],\n",
       " [126],\n",
       " [126],\n",
       " [127],\n",
       " [127],\n",
       " [128],\n",
       " [128],\n",
       " [129],\n",
       " [129],\n",
       " [130],\n",
       " [130],\n",
       " [131],\n",
       " [131],\n",
       " [132],\n",
       " [132],\n",
       " [133],\n",
       " [133],\n",
       " [134],\n",
       " [134],\n",
       " [135],\n",
       " [135],\n",
       " [136],\n",
       " [136],\n",
       " [137],\n",
       " [137],\n",
       " [138],\n",
       " [138],\n",
       " [139],\n",
       " [139],\n",
       " [140],\n",
       " [140],\n",
       " [],\n",
       " [],\n",
       " [141],\n",
       " [141],\n",
       " [142],\n",
       " [142],\n",
       " [143],\n",
       " [143],\n",
       " [144],\n",
       " [144],\n",
       " [],\n",
       " [],\n",
       " [],\n",
       " [],\n",
       " [145],\n",
       " [145],\n",
       " [146],\n",
       " [146],\n",
       " [147],\n",
       " [147],\n",
       " [148],\n",
       " [148],\n",
       " [149],\n",
       " [149],\n",
       " [150],\n",
       " [150],\n",
       " [151],\n",
       " [151],\n",
       " [],\n",
       " [],\n",
       " [152],\n",
       " [152],\n",
       " [153],\n",
       " [153],\n",
       " [154],\n",
       " [154],\n",
       " [155],\n",
       " [155],\n",
       " [156],\n",
       " [156],\n",
       " [157],\n",
       " [157],\n",
       " [158],\n",
       " [158],\n",
       " [159],\n",
       " [159],\n",
       " [160],\n",
       " [160],\n",
       " [161],\n",
       " [161],\n",
       " [162],\n",
       " [162],\n",
       " [163],\n",
       " [163],\n",
       " [164],\n",
       " [164],\n",
       " [165],\n",
       " [165],\n",
       " [166],\n",
       " [166],\n",
       " [167],\n",
       " [167],\n",
       " [168],\n",
       " [168],\n",
       " [169],\n",
       " [169],\n",
       " [170],\n",
       " [170],\n",
       " [],\n",
       " [],\n",
       " [171],\n",
       " [171],\n",
       " [172],\n",
       " [172],\n",
       " [173],\n",
       " [173],\n",
       " [174],\n",
       " [174],\n",
       " [175],\n",
       " [175],\n",
       " [176],\n",
       " [176],\n",
       " [177],\n",
       " [177],\n",
       " [178],\n",
       " [178],\n",
       " [179],\n",
       " [179],\n",
       " [180],\n",
       " [180],\n",
       " [181],\n",
       " [181],\n",
       " [182],\n",
       " [182],\n",
       " [183],\n",
       " [183],\n",
       " [184],\n",
       " [184],\n",
       " [185],\n",
       " [185],\n",
       " [186],\n",
       " [186],\n",
       " [187],\n",
       " [187],\n",
       " [188],\n",
       " [188],\n",
       " [189],\n",
       " [189],\n",
       " [190],\n",
       " [],\n",
       " [190],\n",
       " [],\n",
       " [191],\n",
       " [191],\n",
       " [192],\n",
       " [192],\n",
       " [],\n",
       " [],\n",
       " [193],\n",
       " [193],\n",
       " [194],\n",
       " [194],\n",
       " [195],\n",
       " [195],\n",
       " [196],\n",
       " [196],\n",
       " [197],\n",
       " [197],\n",
       " [198],\n",
       " [198],\n",
       " [199],\n",
       " [199],\n",
       " [200],\n",
       " [200],\n",
       " [201],\n",
       " [201],\n",
       " [202],\n",
       " [202],\n",
       " [203],\n",
       " [203],\n",
       " [204],\n",
       " [204],\n",
       " [204],\n",
       " [204],\n",
       " [205],\n",
       " [205],\n",
       " [206],\n",
       " [206],\n",
       " [207],\n",
       " [207],\n",
       " [208],\n",
       " [208],\n",
       " [209],\n",
       " [209],\n",
       " [210],\n",
       " [210],\n",
       " [211],\n",
       " [211],\n",
       " [212],\n",
       " [212],\n",
       " [213],\n",
       " [213],\n",
       " [214],\n",
       " [214],\n",
       " [215],\n",
       " [215],\n",
       " [216],\n",
       " [216],\n",
       " [217],\n",
       " [217],\n",
       " [218],\n",
       " [218],\n",
       " [219],\n",
       " [219],\n",
       " [220],\n",
       " [220],\n",
       " [221],\n",
       " [221],\n",
       " [],\n",
       " [],\n",
       " [],\n",
       " [],\n",
       " [222],\n",
       " [222],\n",
       " [223],\n",
       " [223],\n",
       " [224],\n",
       " [224],\n",
       " [225],\n",
       " [225],\n",
       " [226],\n",
       " [226],\n",
       " [227],\n",
       " [227],\n",
       " [228],\n",
       " [228],\n",
       " [229],\n",
       " [229],\n",
       " [230],\n",
       " [230],\n",
       " [231],\n",
       " [231],\n",
       " [],\n",
       " [],\n",
       " [232],\n",
       " [232],\n",
       " [233],\n",
       " [233],\n",
       " [234],\n",
       " [234],\n",
       " [235],\n",
       " [235],\n",
       " [236],\n",
       " [236],\n",
       " [237],\n",
       " [237],\n",
       " [238],\n",
       " [238],\n",
       " [239],\n",
       " [239],\n",
       " [240],\n",
       " [240],\n",
       " [241],\n",
       " [241],\n",
       " [242],\n",
       " [242],\n",
       " [243],\n",
       " [243],\n",
       " [244],\n",
       " [244],\n",
       " [],\n",
       " [],\n",
       " [245],\n",
       " [245],\n",
       " [246],\n",
       " [246],\n",
       " [247],\n",
       " [247],\n",
       " [248],\n",
       " [248],\n",
       " [249],\n",
       " [249],\n",
       " [250],\n",
       " [250],\n",
       " [251],\n",
       " [251],\n",
       " [252],\n",
       " [252],\n",
       " [253],\n",
       " [253],\n",
       " [254],\n",
       " [254],\n",
       " [255],\n",
       " [255],\n",
       " [256],\n",
       " [256],\n",
       " [257],\n",
       " [257],\n",
       " [258],\n",
       " [258],\n",
       " [259],\n",
       " [259],\n",
       " [259],\n",
       " [259],\n",
       " [260],\n",
       " [260],\n",
       " [261],\n",
       " [261],\n",
       " [262],\n",
       " [262],\n",
       " [263],\n",
       " [263],\n",
       " [],\n",
       " [],\n",
       " [264],\n",
       " [264],\n",
       " [],\n",
       " [],\n",
       " [265],\n",
       " [265],\n",
       " [266],\n",
       " [266],\n",
       " [267],\n",
       " [267],\n",
       " [268],\n",
       " [268],\n",
       " [269],\n",
       " [475],\n",
       " [269],\n",
       " [269],\n",
       " [475],\n",
       " [269],\n",
       " [270],\n",
       " [270],\n",
       " [271],\n",
       " [271],\n",
       " [271],\n",
       " [],\n",
       " [],\n",
       " [271],\n",
       " [272],\n",
       " [272],\n",
       " [],\n",
       " [],\n",
       " [483],\n",
       " [483],\n",
       " [273],\n",
       " [273],\n",
       " [274],\n",
       " [274],\n",
       " [275],\n",
       " [275],\n",
       " [276],\n",
       " [276],\n",
       " [277],\n",
       " [277],\n",
       " [],\n",
       " [278],\n",
       " [278],\n",
       " [],\n",
       " [279],\n",
       " [279],\n",
       " [280],\n",
       " [280],\n",
       " [281],\n",
       " [281],\n",
       " [282],\n",
       " [282],\n",
       " [283],\n",
       " [283],\n",
       " [284],\n",
       " [284],\n",
       " [285],\n",
       " [285],\n",
       " [286],\n",
       " [286],\n",
       " [287],\n",
       " [287],\n",
       " [],\n",
       " [],\n",
       " [],\n",
       " [],\n",
       " [288],\n",
       " [288],\n",
       " [],\n",
       " [289],\n",
       " [],\n",
       " [289],\n",
       " [290],\n",
       " [290],\n",
       " [291],\n",
       " [291],\n",
       " [292],\n",
       " [292],\n",
       " [],\n",
       " [293],\n",
       " [293],\n",
       " [],\n",
       " [294],\n",
       " [294],\n",
       " [295],\n",
       " [295],\n",
       " [296],\n",
       " [296],\n",
       " [297],\n",
       " [297],\n",
       " [298],\n",
       " [298],\n",
       " [299],\n",
       " [299],\n",
       " [300],\n",
       " [300],\n",
       " [301],\n",
       " [301],\n",
       " [302],\n",
       " [302],\n",
       " [],\n",
       " [],\n",
       " [303],\n",
       " [303],\n",
       " [],\n",
       " [],\n",
       " [304],\n",
       " [304],\n",
       " [305],\n",
       " [305],\n",
       " [306],\n",
       " [306],\n",
       " [],\n",
       " [],\n",
       " [],\n",
       " [],\n",
       " [],\n",
       " [307],\n",
       " [307],\n",
       " [],\n",
       " [],\n",
       " [],\n",
       " [],\n",
       " [],\n",
       " [476],\n",
       " [],\n",
       " [],\n",
       " [308],\n",
       " [308],\n",
       " [309],\n",
       " [309],\n",
       " [310],\n",
       " [310],\n",
       " [311],\n",
       " [311],\n",
       " [312],\n",
       " [312],\n",
       " [313],\n",
       " [313],\n",
       " [314],\n",
       " [314],\n",
       " [315],\n",
       " [315],\n",
       " [316],\n",
       " [316],\n",
       " [317],\n",
       " [317],\n",
       " [318],\n",
       " [318],\n",
       " [319],\n",
       " [319],\n",
       " [320],\n",
       " [320],\n",
       " [321],\n",
       " [321],\n",
       " [322],\n",
       " [322],\n",
       " [323],\n",
       " [323],\n",
       " [324],\n",
       " [324],\n",
       " [325],\n",
       " [325],\n",
       " [326],\n",
       " [326],\n",
       " [327],\n",
       " [327],\n",
       " [328],\n",
       " [328],\n",
       " [329],\n",
       " [329],\n",
       " [330],\n",
       " [330],\n",
       " [331],\n",
       " [331],\n",
       " [332],\n",
       " [332],\n",
       " [333],\n",
       " [333],\n",
       " [334],\n",
       " [334],\n",
       " [335],\n",
       " [335],\n",
       " [336],\n",
       " [336],\n",
       " [337],\n",
       " [337],\n",
       " [338],\n",
       " [338],\n",
       " [339],\n",
       " [339],\n",
       " [340],\n",
       " [340],\n",
       " [341],\n",
       " [341],\n",
       " [342],\n",
       " [342],\n",
       " [343],\n",
       " [343],\n",
       " [],\n",
       " [],\n",
       " [344],\n",
       " [344],\n",
       " [345],\n",
       " [345],\n",
       " [346],\n",
       " [346],\n",
       " [347],\n",
       " [347],\n",
       " [],\n",
       " [],\n",
       " [348],\n",
       " [348],\n",
       " [349],\n",
       " [349],\n",
       " [350],\n",
       " [350],\n",
       " [351],\n",
       " [351],\n",
       " [],\n",
       " [],\n",
       " [352],\n",
       " [352],\n",
       " [353],\n",
       " [353],\n",
       " [354],\n",
       " [354],\n",
       " [355],\n",
       " [355],\n",
       " [356],\n",
       " [356],\n",
       " [357],\n",
       " [357],\n",
       " [358],\n",
       " [358],\n",
       " [],\n",
       " [],\n",
       " [],\n",
       " [],\n",
       " [],\n",
       " [],\n",
       " [359],\n",
       " [359],\n",
       " [360],\n",
       " [360],\n",
       " [361],\n",
       " [361],\n",
       " [362],\n",
       " [362],\n",
       " [],\n",
       " [],\n",
       " [],\n",
       " [],\n",
       " [363],\n",
       " [363],\n",
       " [364],\n",
       " [364],\n",
       " [365],\n",
       " [365],\n",
       " [366],\n",
       " [366],\n",
       " [367],\n",
       " [367],\n",
       " [368],\n",
       " [368],\n",
       " [369],\n",
       " [369],\n",
       " [370],\n",
       " [370],\n",
       " [371],\n",
       " [371],\n",
       " [372],\n",
       " [372],\n",
       " [373],\n",
       " [373],\n",
       " [374],\n",
       " [374],\n",
       " [375],\n",
       " [375],\n",
       " [376],\n",
       " [376],\n",
       " [377],\n",
       " [377],\n",
       " [378],\n",
       " [378],\n",
       " [378],\n",
       " [378],\n",
       " [379],\n",
       " [379],\n",
       " [380],\n",
       " [380],\n",
       " [381],\n",
       " [381],\n",
       " [382],\n",
       " [382],\n",
       " [383],\n",
       " [383],\n",
       " [384],\n",
       " [384],\n",
       " [385],\n",
       " [385],\n",
       " [386],\n",
       " [386],\n",
       " [387],\n",
       " [387],\n",
       " [388],\n",
       " [388],\n",
       " [389],\n",
       " [389],\n",
       " [390],\n",
       " [390],\n",
       " [],\n",
       " [],\n",
       " [],\n",
       " [],\n",
       " [391],\n",
       " [391],\n",
       " [392],\n",
       " [392],\n",
       " [393],\n",
       " [393],\n",
       " [394],\n",
       " [394],\n",
       " [],\n",
       " [],\n",
       " [395],\n",
       " [395],\n",
       " [396],\n",
       " [396],\n",
       " [397],\n",
       " [397],\n",
       " [398],\n",
       " [398],\n",
       " [399],\n",
       " [399],\n",
       " [400],\n",
       " [400],\n",
       " [401],\n",
       " [401],\n",
       " [402],\n",
       " [402],\n",
       " [403],\n",
       " [403],\n",
       " [404],\n",
       " [404],\n",
       " [],\n",
       " [],\n",
       " [405],\n",
       " [405],\n",
       " [406],\n",
       " [406],\n",
       " [407],\n",
       " [407],\n",
       " [],\n",
       " [],\n",
       " [],\n",
       " [],\n",
       " [408],\n",
       " [408],\n",
       " [409],\n",
       " [409],\n",
       " [410],\n",
       " [410],\n",
       " [411],\n",
       " [411],\n",
       " [412],\n",
       " [412],\n",
       " [413],\n",
       " [413],\n",
       " [414],\n",
       " [414],\n",
       " [415],\n",
       " [415],\n",
       " [416],\n",
       " [416],\n",
       " [417],\n",
       " [417],\n",
       " [418],\n",
       " [418],\n",
       " [419],\n",
       " [419],\n",
       " [419],\n",
       " [419],\n",
       " [420],\n",
       " [420],\n",
       " [421],\n",
       " [421],\n",
       " [422],\n",
       " [422],\n",
       " [423],\n",
       " [423],\n",
       " [424],\n",
       " ...]"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results_list = [[int(y) for y in x.tolist()] for x in query_results]\n",
    "\n",
    "print(len(results_list))\n",
    "results_list"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "This shows for each row in trip points, there are zero or one matches, indicating 25 meters was an appropriate choice. At 50 meters, some rows have more than one match. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "max((len(x) for x in results_list))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "min((len(x) for x in results_list))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Merge spatial query results with trip_points\n",
    "Historical trip data with can be compared to the current station list."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# nan if no match, else row_id in df_cur\n",
    "trip_points['match_id'] = np.array([np.float64(x) \n",
    "                                    if x.shape[0] > 0 else np.nan\n",
    "                                    for x in query_results.T])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>name</th>\n",
       "      <th>lat</th>\n",
       "      <th>lon</th>\n",
       "      <th>match_id</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>72</td>\n",
       "      <td>W 52 St &amp; 11 Ave</td>\n",
       "      <td>40.767272</td>\n",
       "      <td>-73.993927</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>72</td>\n",
       "      <td>W 52 St &amp; 11 Ave</td>\n",
       "      <td>40.767273</td>\n",
       "      <td>-73.993926</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>79</td>\n",
       "      <td>Franklin St &amp; W Broadway</td>\n",
       "      <td>40.719118</td>\n",
       "      <td>-74.006668</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>79</td>\n",
       "      <td>Franklin St &amp; W Broadway</td>\n",
       "      <td>40.719117</td>\n",
       "      <td>-74.006671</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>82</td>\n",
       "      <td>St James Pl &amp; Pearl St</td>\n",
       "      <td>40.711174</td>\n",
       "      <td>-74.000166</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   id                      name        lat        lon  match_id\n",
       "0  72          W 52 St & 11 Ave  40.767272 -73.993927       0.0\n",
       "1  72          W 52 St & 11 Ave  40.767273 -73.993926       0.0\n",
       "2  79  Franklin St & W Broadway  40.719118 -74.006668       1.0\n",
       "3  79  Franklin St & W Broadway  40.719117 -74.006671       1.0\n",
       "4  82    St James Pl & Pearl St  40.711174 -74.000166       2.0"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "trip_points.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "df_cur['id'] = df_cur['id'].astype(np.float64)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id_x</th>\n",
       "      <th>name</th>\n",
       "      <th>lat</th>\n",
       "      <th>lon</th>\n",
       "      <th>match_id</th>\n",
       "      <th>id_y</th>\n",
       "      <th>stationName</th>\n",
       "      <th>latitude</th>\n",
       "      <th>longitude</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>72</td>\n",
       "      <td>W 52 St &amp; 11 Ave</td>\n",
       "      <td>40.767272</td>\n",
       "      <td>-73.993927</td>\n",
       "      <td>0.0</td>\n",
       "      <td>72.0</td>\n",
       "      <td>W 52 St &amp; 11 Ave</td>\n",
       "      <td>40.767272</td>\n",
       "      <td>-73.993929</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>72</td>\n",
       "      <td>W 52 St &amp; 11 Ave</td>\n",
       "      <td>40.767273</td>\n",
       "      <td>-73.993926</td>\n",
       "      <td>0.0</td>\n",
       "      <td>72.0</td>\n",
       "      <td>W 52 St &amp; 11 Ave</td>\n",
       "      <td>40.767272</td>\n",
       "      <td>-73.993929</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>79</td>\n",
       "      <td>Franklin St &amp; W Broadway</td>\n",
       "      <td>40.719118</td>\n",
       "      <td>-74.006668</td>\n",
       "      <td>1.0</td>\n",
       "      <td>79.0</td>\n",
       "      <td>Franklin St &amp; W Broadway</td>\n",
       "      <td>40.719116</td>\n",
       "      <td>-74.006667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>79</td>\n",
       "      <td>Franklin St &amp; W Broadway</td>\n",
       "      <td>40.719117</td>\n",
       "      <td>-74.006671</td>\n",
       "      <td>1.0</td>\n",
       "      <td>79.0</td>\n",
       "      <td>Franklin St &amp; W Broadway</td>\n",
       "      <td>40.719116</td>\n",
       "      <td>-74.006667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>82</td>\n",
       "      <td>St James Pl &amp; Pearl St</td>\n",
       "      <td>40.711174</td>\n",
       "      <td>-74.000166</td>\n",
       "      <td>2.0</td>\n",
       "      <td>82.0</td>\n",
       "      <td>St James Pl &amp; Pearl St</td>\n",
       "      <td>40.711174</td>\n",
       "      <td>-74.000165</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>82</td>\n",
       "      <td>St James Pl &amp; Pearl St</td>\n",
       "      <td>40.711174</td>\n",
       "      <td>-74.000167</td>\n",
       "      <td>2.0</td>\n",
       "      <td>82.0</td>\n",
       "      <td>St James Pl &amp; Pearl St</td>\n",
       "      <td>40.711174</td>\n",
       "      <td>-74.000165</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>83</td>\n",
       "      <td>Atlantic Ave &amp; Fort Greene Pl</td>\n",
       "      <td>40.683826</td>\n",
       "      <td>-73.976325</td>\n",
       "      <td>3.0</td>\n",
       "      <td>83.0</td>\n",
       "      <td>Atlantic Ave &amp; Fort Greene Pl</td>\n",
       "      <td>40.683826</td>\n",
       "      <td>-73.976323</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>83</td>\n",
       "      <td>Atlantic Ave &amp; Fort Greene Pl</td>\n",
       "      <td>40.683826</td>\n",
       "      <td>-73.976322</td>\n",
       "      <td>3.0</td>\n",
       "      <td>83.0</td>\n",
       "      <td>Atlantic Ave &amp; Fort Greene Pl</td>\n",
       "      <td>40.683826</td>\n",
       "      <td>-73.976323</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>116</td>\n",
       "      <td>W 17 St &amp; 8 Ave</td>\n",
       "      <td>40.741777</td>\n",
       "      <td>-74.001498</td>\n",
       "      <td>4.0</td>\n",
       "      <td>116.0</td>\n",
       "      <td>W 17 St &amp; 8 Ave</td>\n",
       "      <td>40.741776</td>\n",
       "      <td>-74.001497</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>116</td>\n",
       "      <td>W 17 St &amp; 8 Ave</td>\n",
       "      <td>40.741776</td>\n",
       "      <td>-74.001493</td>\n",
       "      <td>4.0</td>\n",
       "      <td>116.0</td>\n",
       "      <td>W 17 St &amp; 8 Ave</td>\n",
       "      <td>40.741776</td>\n",
       "      <td>-74.001497</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>119</td>\n",
       "      <td>Park Ave &amp; St Edwards St</td>\n",
       "      <td>40.696094</td>\n",
       "      <td>-73.978033</td>\n",
       "      <td>5.0</td>\n",
       "      <td>119.0</td>\n",
       "      <td>Park Ave &amp; St Edwards St</td>\n",
       "      <td>40.696089</td>\n",
       "      <td>-73.978034</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>119</td>\n",
       "      <td>Park Ave &amp; St Edwards St</td>\n",
       "      <td>40.696093</td>\n",
       "      <td>-73.978030</td>\n",
       "      <td>5.0</td>\n",
       "      <td>119.0</td>\n",
       "      <td>Park Ave &amp; St Edwards St</td>\n",
       "      <td>40.696089</td>\n",
       "      <td>-73.978034</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>120</td>\n",
       "      <td>Lexington Ave &amp; Classon Ave</td>\n",
       "      <td>40.686766</td>\n",
       "      <td>-73.959280</td>\n",
       "      <td>6.0</td>\n",
       "      <td>120.0</td>\n",
       "      <td>Lexington Ave &amp; Classon Ave</td>\n",
       "      <td>40.686768</td>\n",
       "      <td>-73.959282</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>120</td>\n",
       "      <td>Lexington Ave &amp; Classon Ave</td>\n",
       "      <td>40.686768</td>\n",
       "      <td>-73.959284</td>\n",
       "      <td>6.0</td>\n",
       "      <td>120.0</td>\n",
       "      <td>Lexington Ave &amp; Classon Ave</td>\n",
       "      <td>40.686768</td>\n",
       "      <td>-73.959282</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>127</td>\n",
       "      <td>Barrow St &amp; Hudson St</td>\n",
       "      <td>40.731725</td>\n",
       "      <td>-74.006747</td>\n",
       "      <td>7.0</td>\n",
       "      <td>127.0</td>\n",
       "      <td>Barrow St &amp; Hudson St</td>\n",
       "      <td>40.731724</td>\n",
       "      <td>-74.006744</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>127</td>\n",
       "      <td>Barrow St &amp; Hudson St</td>\n",
       "      <td>40.731723</td>\n",
       "      <td>-74.006745</td>\n",
       "      <td>7.0</td>\n",
       "      <td>127.0</td>\n",
       "      <td>Barrow St &amp; Hudson St</td>\n",
       "      <td>40.731724</td>\n",
       "      <td>-74.006744</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>128</td>\n",
       "      <td>MacDougal St &amp; Prince St</td>\n",
       "      <td>40.727104</td>\n",
       "      <td>-74.002966</td>\n",
       "      <td>8.0</td>\n",
       "      <td>128.0</td>\n",
       "      <td>MacDougal St &amp; Prince St</td>\n",
       "      <td>40.727103</td>\n",
       "      <td>-74.002971</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>128</td>\n",
       "      <td>MacDougal St &amp; Prince St</td>\n",
       "      <td>40.727104</td>\n",
       "      <td>-74.002966</td>\n",
       "      <td>8.0</td>\n",
       "      <td>128.0</td>\n",
       "      <td>MacDougal St &amp; Prince St</td>\n",
       "      <td>40.727103</td>\n",
       "      <td>-74.002971</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>137</td>\n",
       "      <td>E 56 St &amp; Madison Ave</td>\n",
       "      <td>40.761628</td>\n",
       "      <td>-73.972924</td>\n",
       "      <td>9.0</td>\n",
       "      <td>137.0</td>\n",
       "      <td>E 56 St &amp; Madison Ave</td>\n",
       "      <td>40.761628</td>\n",
       "      <td>-73.972924</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>137</td>\n",
       "      <td>E 56 St &amp; Madison Ave</td>\n",
       "      <td>40.761625</td>\n",
       "      <td>-73.972924</td>\n",
       "      <td>9.0</td>\n",
       "      <td>137.0</td>\n",
       "      <td>E 56 St &amp; Madison Ave</td>\n",
       "      <td>40.761628</td>\n",
       "      <td>-73.972924</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>143</td>\n",
       "      <td>Clinton St &amp; Joralemon St</td>\n",
       "      <td>40.692394</td>\n",
       "      <td>-73.993375</td>\n",
       "      <td>10.0</td>\n",
       "      <td>143.0</td>\n",
       "      <td>Clinton St &amp; Joralemon St</td>\n",
       "      <td>40.692395</td>\n",
       "      <td>-73.993379</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>143</td>\n",
       "      <td>Clinton St &amp; Joralemon St</td>\n",
       "      <td>40.692393</td>\n",
       "      <td>-73.993375</td>\n",
       "      <td>10.0</td>\n",
       "      <td>143.0</td>\n",
       "      <td>Clinton St &amp; Joralemon St</td>\n",
       "      <td>40.692395</td>\n",
       "      <td>-73.993379</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>144</td>\n",
       "      <td>Nassau St &amp; Navy St</td>\n",
       "      <td>40.698401</td>\n",
       "      <td>-73.980691</td>\n",
       "      <td>11.0</td>\n",
       "      <td>144.0</td>\n",
       "      <td>Nassau St &amp; Navy St</td>\n",
       "      <td>40.698399</td>\n",
       "      <td>-73.980689</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>144</td>\n",
       "      <td>Nassau St &amp; Navy St</td>\n",
       "      <td>40.698402</td>\n",
       "      <td>-73.980690</td>\n",
       "      <td>11.0</td>\n",
       "      <td>144.0</td>\n",
       "      <td>Nassau St &amp; Navy St</td>\n",
       "      <td>40.698399</td>\n",
       "      <td>-73.980689</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>146</td>\n",
       "      <td>Hudson St &amp; Reade St</td>\n",
       "      <td>40.716253</td>\n",
       "      <td>-74.009111</td>\n",
       "      <td>12.0</td>\n",
       "      <td>146.0</td>\n",
       "      <td>Hudson St &amp; Reade St</td>\n",
       "      <td>40.716250</td>\n",
       "      <td>-74.009106</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>146</td>\n",
       "      <td>Hudson St &amp; Reade St</td>\n",
       "      <td>40.716250</td>\n",
       "      <td>-74.009108</td>\n",
       "      <td>12.0</td>\n",
       "      <td>146.0</td>\n",
       "      <td>Hudson St &amp; Reade St</td>\n",
       "      <td>40.716250</td>\n",
       "      <td>-74.009106</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>147</td>\n",
       "      <td>Greenwich St &amp; Warren St</td>\n",
       "      <td>40.715423</td>\n",
       "      <td>-74.011220</td>\n",
       "      <td>13.0</td>\n",
       "      <td>147.0</td>\n",
       "      <td>Greenwich St &amp; Warren St</td>\n",
       "      <td>40.715422</td>\n",
       "      <td>-74.011220</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>147</td>\n",
       "      <td>Greenwich St &amp; Warren St</td>\n",
       "      <td>40.715424</td>\n",
       "      <td>-74.011226</td>\n",
       "      <td>13.0</td>\n",
       "      <td>147.0</td>\n",
       "      <td>Greenwich St &amp; Warren St</td>\n",
       "      <td>40.715422</td>\n",
       "      <td>-74.011220</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>150</td>\n",
       "      <td>E 2 St &amp; Avenue C</td>\n",
       "      <td>40.720874</td>\n",
       "      <td>-73.980854</td>\n",
       "      <td>14.0</td>\n",
       "      <td>150.0</td>\n",
       "      <td>E 2 St &amp; Avenue C</td>\n",
       "      <td>40.720874</td>\n",
       "      <td>-73.980858</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>150</td>\n",
       "      <td>E 2 St &amp; Avenue C</td>\n",
       "      <td>40.720875</td>\n",
       "      <td>-73.980855</td>\n",
       "      <td>14.0</td>\n",
       "      <td>150.0</td>\n",
       "      <td>E 2 St &amp; Avenue C</td>\n",
       "      <td>40.720874</td>\n",
       "      <td>-73.980858</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1383</th>\n",
       "      <td>3422</td>\n",
       "      <td>Columbia St &amp; Degraw St</td>\n",
       "      <td>40.685927</td>\n",
       "      <td>-74.002429</td>\n",
       "      <td>638.0</td>\n",
       "      <td>3422.0</td>\n",
       "      <td>Columbia St &amp; Degraw St</td>\n",
       "      <td>40.685930</td>\n",
       "      <td>-74.002424</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1384</th>\n",
       "      <td>3423</td>\n",
       "      <td>West Drive &amp; Prospect Park West</td>\n",
       "      <td>40.661064</td>\n",
       "      <td>-73.979458</td>\n",
       "      <td>639.0</td>\n",
       "      <td>3423.0</td>\n",
       "      <td>West Drive &amp; Prospect Park West</td>\n",
       "      <td>40.661063</td>\n",
       "      <td>-73.979453</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1385</th>\n",
       "      <td>3423</td>\n",
       "      <td>West Drive &amp; Prospect Park West</td>\n",
       "      <td>40.661066</td>\n",
       "      <td>-73.979451</td>\n",
       "      <td>639.0</td>\n",
       "      <td>3423.0</td>\n",
       "      <td>West Drive &amp; Prospect Park West</td>\n",
       "      <td>40.661063</td>\n",
       "      <td>-73.979453</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1386</th>\n",
       "      <td>3424</td>\n",
       "      <td>E 106 St &amp; Lexington Ave</td>\n",
       "      <td>40.791978</td>\n",
       "      <td>-73.945991</td>\n",
       "      <td>640.0</td>\n",
       "      <td>3424.0</td>\n",
       "      <td>E 106 St &amp; Lexington Ave</td>\n",
       "      <td>40.791976</td>\n",
       "      <td>-73.945993</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1387</th>\n",
       "      <td>3424</td>\n",
       "      <td>E 106 St &amp; Lexington Ave</td>\n",
       "      <td>40.791976</td>\n",
       "      <td>-73.945994</td>\n",
       "      <td>640.0</td>\n",
       "      <td>3424.0</td>\n",
       "      <td>E 106 St &amp; Lexington Ave</td>\n",
       "      <td>40.791976</td>\n",
       "      <td>-73.945993</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1388</th>\n",
       "      <td>3425</td>\n",
       "      <td>2 Ave  &amp; E 104 St</td>\n",
       "      <td>40.789212</td>\n",
       "      <td>-73.943714</td>\n",
       "      <td>641.0</td>\n",
       "      <td>3425.0</td>\n",
       "      <td>2 Ave  &amp; E 104 St</td>\n",
       "      <td>40.789211</td>\n",
       "      <td>-73.943708</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1389</th>\n",
       "      <td>3425</td>\n",
       "      <td>2 Ave  &amp; E 104 St</td>\n",
       "      <td>40.789211</td>\n",
       "      <td>-73.943708</td>\n",
       "      <td>641.0</td>\n",
       "      <td>3425.0</td>\n",
       "      <td>2 Ave  &amp; E 104 St</td>\n",
       "      <td>40.789211</td>\n",
       "      <td>-73.943708</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1390</th>\n",
       "      <td>3427</td>\n",
       "      <td>Lafayette St &amp; Jersey St</td>\n",
       "      <td>40.724303</td>\n",
       "      <td>-73.996004</td>\n",
       "      <td>642.0</td>\n",
       "      <td>3427.0</td>\n",
       "      <td>Lafayette St &amp; Jersey St</td>\n",
       "      <td>40.724305</td>\n",
       "      <td>-73.996010</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1391</th>\n",
       "      <td>3427</td>\n",
       "      <td>Lafayette St &amp; Jersey St</td>\n",
       "      <td>40.724304</td>\n",
       "      <td>-73.996006</td>\n",
       "      <td>642.0</td>\n",
       "      <td>3427.0</td>\n",
       "      <td>Lafayette St &amp; Jersey St</td>\n",
       "      <td>40.724305</td>\n",
       "      <td>-73.996010</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1392</th>\n",
       "      <td>3428</td>\n",
       "      <td>8 Ave &amp; W 16 St</td>\n",
       "      <td>40.740986</td>\n",
       "      <td>-74.001695</td>\n",
       "      <td>643.0</td>\n",
       "      <td>3428.0</td>\n",
       "      <td>8 Ave &amp; W 16 St</td>\n",
       "      <td>40.740983</td>\n",
       "      <td>-74.001702</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1393</th>\n",
       "      <td>3428</td>\n",
       "      <td>8 Ave &amp; W 16 St</td>\n",
       "      <td>40.740985</td>\n",
       "      <td>-74.001704</td>\n",
       "      <td>643.0</td>\n",
       "      <td>3428.0</td>\n",
       "      <td>8 Ave &amp; W 16 St</td>\n",
       "      <td>40.740983</td>\n",
       "      <td>-74.001702</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1394</th>\n",
       "      <td>3429</td>\n",
       "      <td>Hanson Pl &amp; Ashland Pl</td>\n",
       "      <td>40.685067</td>\n",
       "      <td>-73.977907</td>\n",
       "      <td>644.0</td>\n",
       "      <td>3429.0</td>\n",
       "      <td>Hanson Pl &amp; Ashland Pl</td>\n",
       "      <td>40.685068</td>\n",
       "      <td>-73.977908</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1395</th>\n",
       "      <td>3429</td>\n",
       "      <td>Hanson Pl &amp; Ashland Pl</td>\n",
       "      <td>40.685065</td>\n",
       "      <td>-73.977906</td>\n",
       "      <td>644.0</td>\n",
       "      <td>3429.0</td>\n",
       "      <td>Hanson Pl &amp; Ashland Pl</td>\n",
       "      <td>40.685068</td>\n",
       "      <td>-73.977908</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1396</th>\n",
       "      <td>3430</td>\n",
       "      <td>Richardson St &amp; N Henry St</td>\n",
       "      <td>40.719078</td>\n",
       "      <td>-73.942233</td>\n",
       "      <td>645.0</td>\n",
       "      <td>3430.0</td>\n",
       "      <td>Richardson St &amp; N Henry St</td>\n",
       "      <td>40.719079</td>\n",
       "      <td>-73.942237</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1397</th>\n",
       "      <td>3430</td>\n",
       "      <td>Richardson St &amp; N Henry St</td>\n",
       "      <td>40.719081</td>\n",
       "      <td>-73.942231</td>\n",
       "      <td>645.0</td>\n",
       "      <td>3430.0</td>\n",
       "      <td>Richardson St &amp; N Henry St</td>\n",
       "      <td>40.719079</td>\n",
       "      <td>-73.942237</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1398</th>\n",
       "      <td>3431</td>\n",
       "      <td>E 35 St &amp; 3 Ave</td>\n",
       "      <td>40.746526</td>\n",
       "      <td>-73.977886</td>\n",
       "      <td>646.0</td>\n",
       "      <td>3431.0</td>\n",
       "      <td>E 35 St &amp; 3 Ave</td>\n",
       "      <td>40.746524</td>\n",
       "      <td>-73.977885</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1399</th>\n",
       "      <td>3431</td>\n",
       "      <td>E 35 St &amp; 3 Ave</td>\n",
       "      <td>40.746523</td>\n",
       "      <td>-73.977879</td>\n",
       "      <td>646.0</td>\n",
       "      <td>3431.0</td>\n",
       "      <td>E 35 St &amp; 3 Ave</td>\n",
       "      <td>40.746524</td>\n",
       "      <td>-73.977885</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1400</th>\n",
       "      <td>3432</td>\n",
       "      <td>Bike in Movie Night | Prospect Park Bandshell</td>\n",
       "      <td>40.662987</td>\n",
       "      <td>-73.976919</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1401</th>\n",
       "      <td>3432</td>\n",
       "      <td>Bike in Movie Night | Prospect Park Bandshell</td>\n",
       "      <td>40.662988</td>\n",
       "      <td>-73.976922</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1402</th>\n",
       "      <td>3434</td>\n",
       "      <td>W 88 St &amp; West End Ave</td>\n",
       "      <td>40.790251</td>\n",
       "      <td>-73.977181</td>\n",
       "      <td>647.0</td>\n",
       "      <td>3434.0</td>\n",
       "      <td>W 88 St &amp; West End Ave</td>\n",
       "      <td>40.790254</td>\n",
       "      <td>-73.977183</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1403</th>\n",
       "      <td>3434</td>\n",
       "      <td>W 88 St &amp; West End Ave</td>\n",
       "      <td>40.790254</td>\n",
       "      <td>-73.977179</td>\n",
       "      <td>647.0</td>\n",
       "      <td>3434.0</td>\n",
       "      <td>W 88 St &amp; West End Ave</td>\n",
       "      <td>40.790254</td>\n",
       "      <td>-73.977183</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1404</th>\n",
       "      <td>3435</td>\n",
       "      <td>Grand St &amp; Elizabeth St</td>\n",
       "      <td>40.718822</td>\n",
       "      <td>-73.995959</td>\n",
       "      <td>648.0</td>\n",
       "      <td>3435.0</td>\n",
       "      <td>Grand St &amp; Elizabeth St</td>\n",
       "      <td>40.718822</td>\n",
       "      <td>-73.995960</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1405</th>\n",
       "      <td>3435</td>\n",
       "      <td>Grand St &amp; Elizabeth St</td>\n",
       "      <td>40.718820</td>\n",
       "      <td>-73.995958</td>\n",
       "      <td>648.0</td>\n",
       "      <td>3435.0</td>\n",
       "      <td>Grand St &amp; Elizabeth St</td>\n",
       "      <td>40.718822</td>\n",
       "      <td>-73.995960</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1406</th>\n",
       "      <td>3436</td>\n",
       "      <td>Greenwich St &amp; Hubert St</td>\n",
       "      <td>40.721319</td>\n",
       "      <td>-74.010065</td>\n",
       "      <td>649.0</td>\n",
       "      <td>3436.0</td>\n",
       "      <td>Greenwich St &amp; Hubert St</td>\n",
       "      <td>40.721319</td>\n",
       "      <td>-74.010065</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1407</th>\n",
       "      <td>3436</td>\n",
       "      <td>Greenwich St &amp; Hubert St</td>\n",
       "      <td>40.721318</td>\n",
       "      <td>-74.010060</td>\n",
       "      <td>649.0</td>\n",
       "      <td>3436.0</td>\n",
       "      <td>Greenwich St &amp; Hubert St</td>\n",
       "      <td>40.721319</td>\n",
       "      <td>-74.010065</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1408</th>\n",
       "      <td>3438</td>\n",
       "      <td>E 76 St &amp; 3 Ave</td>\n",
       "      <td>40.772249</td>\n",
       "      <td>-73.958419</td>\n",
       "      <td>650.0</td>\n",
       "      <td>3438.0</td>\n",
       "      <td>E 76 St &amp; 3 Ave</td>\n",
       "      <td>40.772249</td>\n",
       "      <td>-73.958421</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1409</th>\n",
       "      <td>3438</td>\n",
       "      <td>E 76 St &amp; 3 Ave</td>\n",
       "      <td>40.772249</td>\n",
       "      <td>-73.958419</td>\n",
       "      <td>650.0</td>\n",
       "      <td>3438.0</td>\n",
       "      <td>E 76 St &amp; 3 Ave</td>\n",
       "      <td>40.772249</td>\n",
       "      <td>-73.958421</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1410</th>\n",
       "      <td>3439</td>\n",
       "      <td>Broadway &amp; E 22 St - Valet Scan</td>\n",
       "      <td>40.740345</td>\n",
       "      <td>-73.989548</td>\n",
       "      <td>169.0</td>\n",
       "      <td>402.0</td>\n",
       "      <td>Broadway &amp; E 22 St</td>\n",
       "      <td>40.740343</td>\n",
       "      <td>-73.989551</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1411</th>\n",
       "      <td>3440</td>\n",
       "      <td>Fulton St &amp; Adams St</td>\n",
       "      <td>40.692416</td>\n",
       "      <td>-73.989497</td>\n",
       "      <td>651.0</td>\n",
       "      <td>3440.0</td>\n",
       "      <td>Fulton St &amp; Adams St</td>\n",
       "      <td>40.692418</td>\n",
       "      <td>-73.989495</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1412</th>\n",
       "      <td>3440</td>\n",
       "      <td>Fulton St &amp; Adams St</td>\n",
       "      <td>40.692417</td>\n",
       "      <td>-73.989502</td>\n",
       "      <td>651.0</td>\n",
       "      <td>3440.0</td>\n",
       "      <td>Fulton St &amp; Adams St</td>\n",
       "      <td>40.692418</td>\n",
       "      <td>-73.989495</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1413 rows × 9 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      id_x                                           name        lat  \\\n",
       "0       72                               W 52 St & 11 Ave  40.767272   \n",
       "1       72                               W 52 St & 11 Ave  40.767273   \n",
       "2       79                       Franklin St & W Broadway  40.719118   \n",
       "3       79                       Franklin St & W Broadway  40.719117   \n",
       "4       82                         St James Pl & Pearl St  40.711174   \n",
       "5       82                         St James Pl & Pearl St  40.711174   \n",
       "6       83                  Atlantic Ave & Fort Greene Pl  40.683826   \n",
       "7       83                  Atlantic Ave & Fort Greene Pl  40.683826   \n",
       "8      116                                W 17 St & 8 Ave  40.741777   \n",
       "9      116                                W 17 St & 8 Ave  40.741776   \n",
       "10     119                       Park Ave & St Edwards St  40.696094   \n",
       "11     119                       Park Ave & St Edwards St  40.696093   \n",
       "12     120                    Lexington Ave & Classon Ave  40.686766   \n",
       "13     120                    Lexington Ave & Classon Ave  40.686768   \n",
       "14     127                          Barrow St & Hudson St  40.731725   \n",
       "15     127                          Barrow St & Hudson St  40.731723   \n",
       "16     128                       MacDougal St & Prince St  40.727104   \n",
       "17     128                       MacDougal St & Prince St  40.727104   \n",
       "18     137                          E 56 St & Madison Ave  40.761628   \n",
       "19     137                          E 56 St & Madison Ave  40.761625   \n",
       "20     143                      Clinton St & Joralemon St  40.692394   \n",
       "21     143                      Clinton St & Joralemon St  40.692393   \n",
       "22     144                            Nassau St & Navy St  40.698401   \n",
       "23     144                            Nassau St & Navy St  40.698402   \n",
       "24     146                           Hudson St & Reade St  40.716253   \n",
       "25     146                           Hudson St & Reade St  40.716250   \n",
       "26     147                       Greenwich St & Warren St  40.715423   \n",
       "27     147                       Greenwich St & Warren St  40.715424   \n",
       "28     150                              E 2 St & Avenue C  40.720874   \n",
       "29     150                              E 2 St & Avenue C  40.720875   \n",
       "...    ...                                            ...        ...   \n",
       "1383  3422                        Columbia St & Degraw St  40.685927   \n",
       "1384  3423                West Drive & Prospect Park West  40.661064   \n",
       "1385  3423                West Drive & Prospect Park West  40.661066   \n",
       "1386  3424                       E 106 St & Lexington Ave  40.791978   \n",
       "1387  3424                       E 106 St & Lexington Ave  40.791976   \n",
       "1388  3425                              2 Ave  & E 104 St  40.789212   \n",
       "1389  3425                              2 Ave  & E 104 St  40.789211   \n",
       "1390  3427                       Lafayette St & Jersey St  40.724303   \n",
       "1391  3427                       Lafayette St & Jersey St  40.724304   \n",
       "1392  3428                                8 Ave & W 16 St  40.740986   \n",
       "1393  3428                                8 Ave & W 16 St  40.740985   \n",
       "1394  3429                         Hanson Pl & Ashland Pl  40.685067   \n",
       "1395  3429                         Hanson Pl & Ashland Pl  40.685065   \n",
       "1396  3430                     Richardson St & N Henry St  40.719078   \n",
       "1397  3430                     Richardson St & N Henry St  40.719081   \n",
       "1398  3431                                E 35 St & 3 Ave  40.746526   \n",
       "1399  3431                                E 35 St & 3 Ave  40.746523   \n",
       "1400  3432  Bike in Movie Night | Prospect Park Bandshell  40.662987   \n",
       "1401  3432  Bike in Movie Night | Prospect Park Bandshell  40.662988   \n",
       "1402  3434                         W 88 St & West End Ave  40.790251   \n",
       "1403  3434                         W 88 St & West End Ave  40.790254   \n",
       "1404  3435                        Grand St & Elizabeth St  40.718822   \n",
       "1405  3435                        Grand St & Elizabeth St  40.718820   \n",
       "1406  3436                       Greenwich St & Hubert St  40.721319   \n",
       "1407  3436                       Greenwich St & Hubert St  40.721318   \n",
       "1408  3438                                E 76 St & 3 Ave  40.772249   \n",
       "1409  3438                                E 76 St & 3 Ave  40.772249   \n",
       "1410  3439                Broadway & E 22 St - Valet Scan  40.740345   \n",
       "1411  3440                           Fulton St & Adams St  40.692416   \n",
       "1412  3440                           Fulton St & Adams St  40.692417   \n",
       "\n",
       "            lon  match_id    id_y                      stationName   latitude  \\\n",
       "0    -73.993927       0.0    72.0                 W 52 St & 11 Ave  40.767272   \n",
       "1    -73.993926       0.0    72.0                 W 52 St & 11 Ave  40.767272   \n",
       "2    -74.006668       1.0    79.0         Franklin St & W Broadway  40.719116   \n",
       "3    -74.006671       1.0    79.0         Franklin St & W Broadway  40.719116   \n",
       "4    -74.000166       2.0    82.0           St James Pl & Pearl St  40.711174   \n",
       "5    -74.000167       2.0    82.0           St James Pl & Pearl St  40.711174   \n",
       "6    -73.976325       3.0    83.0    Atlantic Ave & Fort Greene Pl  40.683826   \n",
       "7    -73.976322       3.0    83.0    Atlantic Ave & Fort Greene Pl  40.683826   \n",
       "8    -74.001498       4.0   116.0                  W 17 St & 8 Ave  40.741776   \n",
       "9    -74.001493       4.0   116.0                  W 17 St & 8 Ave  40.741776   \n",
       "10   -73.978033       5.0   119.0         Park Ave & St Edwards St  40.696089   \n",
       "11   -73.978030       5.0   119.0         Park Ave & St Edwards St  40.696089   \n",
       "12   -73.959280       6.0   120.0      Lexington Ave & Classon Ave  40.686768   \n",
       "13   -73.959284       6.0   120.0      Lexington Ave & Classon Ave  40.686768   \n",
       "14   -74.006747       7.0   127.0            Barrow St & Hudson St  40.731724   \n",
       "15   -74.006745       7.0   127.0            Barrow St & Hudson St  40.731724   \n",
       "16   -74.002966       8.0   128.0         MacDougal St & Prince St  40.727103   \n",
       "17   -74.002966       8.0   128.0         MacDougal St & Prince St  40.727103   \n",
       "18   -73.972924       9.0   137.0            E 56 St & Madison Ave  40.761628   \n",
       "19   -73.972924       9.0   137.0            E 56 St & Madison Ave  40.761628   \n",
       "20   -73.993375      10.0   143.0        Clinton St & Joralemon St  40.692395   \n",
       "21   -73.993375      10.0   143.0        Clinton St & Joralemon St  40.692395   \n",
       "22   -73.980691      11.0   144.0              Nassau St & Navy St  40.698399   \n",
       "23   -73.980690      11.0   144.0              Nassau St & Navy St  40.698399   \n",
       "24   -74.009111      12.0   146.0             Hudson St & Reade St  40.716250   \n",
       "25   -74.009108      12.0   146.0             Hudson St & Reade St  40.716250   \n",
       "26   -74.011220      13.0   147.0         Greenwich St & Warren St  40.715422   \n",
       "27   -74.011226      13.0   147.0         Greenwich St & Warren St  40.715422   \n",
       "28   -73.980854      14.0   150.0                E 2 St & Avenue C  40.720874   \n",
       "29   -73.980855      14.0   150.0                E 2 St & Avenue C  40.720874   \n",
       "...         ...       ...     ...                              ...        ...   \n",
       "1383 -74.002429     638.0  3422.0          Columbia St & Degraw St  40.685930   \n",
       "1384 -73.979458     639.0  3423.0  West Drive & Prospect Park West  40.661063   \n",
       "1385 -73.979451     639.0  3423.0  West Drive & Prospect Park West  40.661063   \n",
       "1386 -73.945991     640.0  3424.0         E 106 St & Lexington Ave  40.791976   \n",
       "1387 -73.945994     640.0  3424.0         E 106 St & Lexington Ave  40.791976   \n",
       "1388 -73.943714     641.0  3425.0                2 Ave  & E 104 St  40.789211   \n",
       "1389 -73.943708     641.0  3425.0                2 Ave  & E 104 St  40.789211   \n",
       "1390 -73.996004     642.0  3427.0         Lafayette St & Jersey St  40.724305   \n",
       "1391 -73.996006     642.0  3427.0         Lafayette St & Jersey St  40.724305   \n",
       "1392 -74.001695     643.0  3428.0                  8 Ave & W 16 St  40.740983   \n",
       "1393 -74.001704     643.0  3428.0                  8 Ave & W 16 St  40.740983   \n",
       "1394 -73.977907     644.0  3429.0           Hanson Pl & Ashland Pl  40.685068   \n",
       "1395 -73.977906     644.0  3429.0           Hanson Pl & Ashland Pl  40.685068   \n",
       "1396 -73.942233     645.0  3430.0       Richardson St & N Henry St  40.719079   \n",
       "1397 -73.942231     645.0  3430.0       Richardson St & N Henry St  40.719079   \n",
       "1398 -73.977886     646.0  3431.0                  E 35 St & 3 Ave  40.746524   \n",
       "1399 -73.977879     646.0  3431.0                  E 35 St & 3 Ave  40.746524   \n",
       "1400 -73.976919       NaN     NaN                              NaN        NaN   \n",
       "1401 -73.976922       NaN     NaN                              NaN        NaN   \n",
       "1402 -73.977181     647.0  3434.0           W 88 St & West End Ave  40.790254   \n",
       "1403 -73.977179     647.0  3434.0           W 88 St & West End Ave  40.790254   \n",
       "1404 -73.995959     648.0  3435.0          Grand St & Elizabeth St  40.718822   \n",
       "1405 -73.995958     648.0  3435.0          Grand St & Elizabeth St  40.718822   \n",
       "1406 -74.010065     649.0  3436.0         Greenwich St & Hubert St  40.721319   \n",
       "1407 -74.010060     649.0  3436.0         Greenwich St & Hubert St  40.721319   \n",
       "1408 -73.958419     650.0  3438.0                  E 76 St & 3 Ave  40.772249   \n",
       "1409 -73.958419     650.0  3438.0                  E 76 St & 3 Ave  40.772249   \n",
       "1410 -73.989548     169.0   402.0               Broadway & E 22 St  40.740343   \n",
       "1411 -73.989497     651.0  3440.0             Fulton St & Adams St  40.692418   \n",
       "1412 -73.989502     651.0  3440.0             Fulton St & Adams St  40.692418   \n",
       "\n",
       "      longitude  \n",
       "0    -73.993929  \n",
       "1    -73.993929  \n",
       "2    -74.006667  \n",
       "3    -74.006667  \n",
       "4    -74.000165  \n",
       "5    -74.000165  \n",
       "6    -73.976323  \n",
       "7    -73.976323  \n",
       "8    -74.001497  \n",
       "9    -74.001497  \n",
       "10   -73.978034  \n",
       "11   -73.978034  \n",
       "12   -73.959282  \n",
       "13   -73.959282  \n",
       "14   -74.006744  \n",
       "15   -74.006744  \n",
       "16   -74.002971  \n",
       "17   -74.002971  \n",
       "18   -73.972924  \n",
       "19   -73.972924  \n",
       "20   -73.993379  \n",
       "21   -73.993379  \n",
       "22   -73.980689  \n",
       "23   -73.980689  \n",
       "24   -74.009106  \n",
       "25   -74.009106  \n",
       "26   -74.011220  \n",
       "27   -74.011220  \n",
       "28   -73.980858  \n",
       "29   -73.980858  \n",
       "...         ...  \n",
       "1383 -74.002424  \n",
       "1384 -73.979453  \n",
       "1385 -73.979453  \n",
       "1386 -73.945993  \n",
       "1387 -73.945993  \n",
       "1388 -73.943708  \n",
       "1389 -73.943708  \n",
       "1390 -73.996010  \n",
       "1391 -73.996010  \n",
       "1392 -74.001702  \n",
       "1393 -74.001702  \n",
       "1394 -73.977908  \n",
       "1395 -73.977908  \n",
       "1396 -73.942237  \n",
       "1397 -73.942237  \n",
       "1398 -73.977885  \n",
       "1399 -73.977885  \n",
       "1400        NaN  \n",
       "1401        NaN  \n",
       "1402 -73.977183  \n",
       "1403 -73.977183  \n",
       "1404 -73.995960  \n",
       "1405 -73.995960  \n",
       "1406 -74.010065  \n",
       "1407 -74.010065  \n",
       "1408 -73.958421  \n",
       "1409 -73.958421  \n",
       "1410 -73.989551  \n",
       "1411 -73.989495  \n",
       "1412 -73.989495  \n",
       "\n",
       "[1413 rows x 9 columns]"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lookup_table = trip_points.merge(df_cur, left_on='match_id', right_index=True, how='left')\n",
    "lookup_table"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### The above table shows rows with NaN. These stations have no current counterpart."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "collapsed": false,
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id_x</th>\n",
       "      <th>name</th>\n",
       "      <th>lat</th>\n",
       "      <th>lon</th>\n",
       "      <th>match_id</th>\n",
       "      <th>id_y</th>\n",
       "      <th>stationName</th>\n",
       "      <th>latitude</th>\n",
       "      <th>longitude</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>38</th>\n",
       "      <td>160</td>\n",
       "      <td>E 37 St &amp; Lexington Ave</td>\n",
       "      <td>40.748195</td>\n",
       "      <td>-73.978309</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>39</th>\n",
       "      <td>160</td>\n",
       "      <td>E 37 St &amp; Lexington Ave</td>\n",
       "      <td>40.748192</td>\n",
       "      <td>-73.978310</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>60</th>\n",
       "      <td>218</td>\n",
       "      <td>Gallatin Pl &amp; Livingston St</td>\n",
       "      <td>40.690286</td>\n",
       "      <td>-73.987071</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>61</th>\n",
       "      <td>218</td>\n",
       "      <td>Gallatin Pl &amp; Livingston St</td>\n",
       "      <td>40.690285</td>\n",
       "      <td>-73.987069</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75</th>\n",
       "      <td>233</td>\n",
       "      <td>Cadman Plaza W &amp; Pierrepont St</td>\n",
       "      <td>40.694757</td>\n",
       "      <td>-73.990522</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>77</th>\n",
       "      <td>233</td>\n",
       "      <td>Cadman Plaza W &amp; Pierrepont St</td>\n",
       "      <td>40.694754</td>\n",
       "      <td>-73.990530</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>88</th>\n",
       "      <td>242</td>\n",
       "      <td>Flushing Ave &amp; Carlton Ave</td>\n",
       "      <td>40.697882</td>\n",
       "      <td>-73.973503</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>91</th>\n",
       "      <td>242</td>\n",
       "      <td>Flushing Ave &amp; Carlton Ave</td>\n",
       "      <td>40.697882</td>\n",
       "      <td>-73.973503</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>92</th>\n",
       "      <td>243</td>\n",
       "      <td>Fulton St &amp; Rockwell Pl</td>\n",
       "      <td>40.688151</td>\n",
       "      <td>-73.979105</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>93</th>\n",
       "      <td>243</td>\n",
       "      <td>Fulton St &amp; Rockwell Pl</td>\n",
       "      <td>40.688129</td>\n",
       "      <td>-73.979028</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>104</th>\n",
       "      <td>250</td>\n",
       "      <td>Lafayette St &amp; Jersey St</td>\n",
       "      <td>40.724560</td>\n",
       "      <td>-73.995651</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>105</th>\n",
       "      <td>250</td>\n",
       "      <td>Lafayette St &amp; Jersey St</td>\n",
       "      <td>40.724557</td>\n",
       "      <td>-73.995650</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>106</th>\n",
       "      <td>250</td>\n",
       "      <td>Lafayette St &amp; Jersey St N</td>\n",
       "      <td>40.724560</td>\n",
       "      <td>-73.995653</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>107</th>\n",
       "      <td>250</td>\n",
       "      <td>Lafayette St &amp; Jersey St N</td>\n",
       "      <td>40.724559</td>\n",
       "      <td>-73.995649</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>116</th>\n",
       "      <td>255</td>\n",
       "      <td>NYCBS Depot - SSP</td>\n",
       "      <td>40.646765</td>\n",
       "      <td>-74.016513</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>117</th>\n",
       "      <td>255</td>\n",
       "      <td>NYCBS Depot - SSP</td>\n",
       "      <td>40.646766</td>\n",
       "      <td>-74.016510</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>130</th>\n",
       "      <td>263</td>\n",
       "      <td>Elizabeth St &amp; Hester St</td>\n",
       "      <td>40.717329</td>\n",
       "      <td>-73.996356</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>131</th>\n",
       "      <td>263</td>\n",
       "      <td>Elizabeth St &amp; Hester St</td>\n",
       "      <td>40.717329</td>\n",
       "      <td>-73.996351</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>144</th>\n",
       "      <td>271</td>\n",
       "      <td>Ashland Pl &amp; Hanson Pl</td>\n",
       "      <td>40.685276</td>\n",
       "      <td>-73.978059</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>145</th>\n",
       "      <td>271</td>\n",
       "      <td>Ashland Pl &amp; Hanson Pl</td>\n",
       "      <td>40.685281</td>\n",
       "      <td>-73.978057</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>154</th>\n",
       "      <td>279</td>\n",
       "      <td>Sands St &amp; Gold St</td>\n",
       "      <td>40.699870</td>\n",
       "      <td>-73.982716</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>159</th>\n",
       "      <td>279</td>\n",
       "      <td>Sands St &amp; Gold St</td>\n",
       "      <td>40.699870</td>\n",
       "      <td>-73.982720</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>164</th>\n",
       "      <td>282</td>\n",
       "      <td>Kent Ave &amp; S 11 St</td>\n",
       "      <td>40.708024</td>\n",
       "      <td>-73.968367</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>165</th>\n",
       "      <td>282</td>\n",
       "      <td>Kent Ave &amp; S 11 St</td>\n",
       "      <td>40.708025</td>\n",
       "      <td>-73.968372</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>172</th>\n",
       "      <td>290</td>\n",
       "      <td>2 Ave &amp; E 58 St</td>\n",
       "      <td>40.760204</td>\n",
       "      <td>-73.964786</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>173</th>\n",
       "      <td>290</td>\n",
       "      <td>2 Ave &amp; E 58 St</td>\n",
       "      <td>40.760206</td>\n",
       "      <td>-73.964780</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>176</th>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "      <td>40.730284</td>\n",
       "      <td>-73.990770</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>177</th>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "      <td>40.730285</td>\n",
       "      <td>-73.990771</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>178</th>\n",
       "      <td>294</td>\n",
       "      <td>Washington Square E</td>\n",
       "      <td>40.730497</td>\n",
       "      <td>-73.995719</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>179</th>\n",
       "      <td>294</td>\n",
       "      <td>Washington Square E</td>\n",
       "      <td>40.730495</td>\n",
       "      <td>-73.995721</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1053</th>\n",
       "      <td>3229</td>\n",
       "      <td>Marcy Ave &amp; MacDonough St</td>\n",
       "      <td>40.680620</td>\n",
       "      <td>-73.946245</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1054</th>\n",
       "      <td>3230</td>\n",
       "      <td>Penn Station Valet</td>\n",
       "      <td>40.751282</td>\n",
       "      <td>-73.996927</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1055</th>\n",
       "      <td>3230</td>\n",
       "      <td>Penn Station Valet</td>\n",
       "      <td>40.751279</td>\n",
       "      <td>-73.996926</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1062</th>\n",
       "      <td>3234</td>\n",
       "      <td>E 40 St &amp; Madison Ave</td>\n",
       "      <td>40.751593</td>\n",
       "      <td>-73.980427</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1063</th>\n",
       "      <td>3234</td>\n",
       "      <td>E 40 St &amp; Madison Ave</td>\n",
       "      <td>40.751592</td>\n",
       "      <td>-73.980430</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1070</th>\n",
       "      <td>3237</td>\n",
       "      <td>21 St &amp; 41 Ave</td>\n",
       "      <td>40.753832</td>\n",
       "      <td>-73.942681</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1071</th>\n",
       "      <td>3237</td>\n",
       "      <td>21 St &amp; 41 Ave</td>\n",
       "      <td>40.753833</td>\n",
       "      <td>-73.942676</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1074</th>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "      <td>40.646539</td>\n",
       "      <td>-74.016588</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1083</th>\n",
       "      <td>3245</td>\n",
       "      <td>Kiosk in a box Motivate</td>\n",
       "      <td>40.646677</td>\n",
       "      <td>-74.016298</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1084</th>\n",
       "      <td>3246</td>\n",
       "      <td>Montague St &amp; Clinton St</td>\n",
       "      <td>40.694282</td>\n",
       "      <td>-73.992300</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1085</th>\n",
       "      <td>3246</td>\n",
       "      <td>Montague St &amp; Clinton St</td>\n",
       "      <td>40.694284</td>\n",
       "      <td>-73.992301</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1088</th>\n",
       "      <td>3250</td>\n",
       "      <td>NYCBS Depot - PIT</td>\n",
       "      <td>40.716912</td>\n",
       "      <td>-73.983843</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1089</th>\n",
       "      <td>3250</td>\n",
       "      <td>NYCBS Depot - PIT</td>\n",
       "      <td>40.716913</td>\n",
       "      <td>-73.983843</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1092</th>\n",
       "      <td>3253</td>\n",
       "      <td>Bike The Branches - Central Branch</td>\n",
       "      <td>40.672804</td>\n",
       "      <td>-73.968868</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1093</th>\n",
       "      <td>3253</td>\n",
       "      <td>Bike The Branches - Central Branch</td>\n",
       "      <td>40.672806</td>\n",
       "      <td>-73.968864</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1094</th>\n",
       "      <td>3254</td>\n",
       "      <td>Soissons Landing</td>\n",
       "      <td>40.692320</td>\n",
       "      <td>-74.014862</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1095</th>\n",
       "      <td>3254</td>\n",
       "      <td>Soissons Landing</td>\n",
       "      <td>40.692319</td>\n",
       "      <td>-74.014863</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1100</th>\n",
       "      <td>3257</td>\n",
       "      <td>Adventures NYC</td>\n",
       "      <td>40.773769</td>\n",
       "      <td>-73.971169</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1101</th>\n",
       "      <td>3257</td>\n",
       "      <td>Adventures NYC</td>\n",
       "      <td>40.773771</td>\n",
       "      <td>-73.971169</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1110</th>\n",
       "      <td>3264</td>\n",
       "      <td>E 61 St &amp; Park Ave</td>\n",
       "      <td>40.764207</td>\n",
       "      <td>-73.969101</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1111</th>\n",
       "      <td>3264</td>\n",
       "      <td>E 61 St &amp; Park Ave</td>\n",
       "      <td>40.764210</td>\n",
       "      <td>-73.969101</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1112</th>\n",
       "      <td>3265</td>\n",
       "      <td>E 2 St &amp; 2 Ave</td>\n",
       "      <td>40.724565</td>\n",
       "      <td>-73.989439</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1113</th>\n",
       "      <td>3265</td>\n",
       "      <td>E 2 St &amp; 2 Ave</td>\n",
       "      <td>40.724564</td>\n",
       "      <td>-73.989439</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1114</th>\n",
       "      <td>3266</td>\n",
       "      <td>Kiosk in a box Deployment</td>\n",
       "      <td>40.708611</td>\n",
       "      <td>-73.928507</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1115</th>\n",
       "      <td>3266</td>\n",
       "      <td>Kiosk in a box Deployment</td>\n",
       "      <td>40.708609</td>\n",
       "      <td>-73.928510</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1138</th>\n",
       "      <td>3291</td>\n",
       "      <td>Riverside Dr &amp; W 91 St</td>\n",
       "      <td>40.793373</td>\n",
       "      <td>-73.976851</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1139</th>\n",
       "      <td>3291</td>\n",
       "      <td>Riverside Dr &amp; W 91 St</td>\n",
       "      <td>40.793372</td>\n",
       "      <td>-73.976853</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1311</th>\n",
       "      <td>3385</td>\n",
       "      <td>2 Ave &amp; E 105 St</td>\n",
       "      <td>40.789818</td>\n",
       "      <td>-73.942963</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1400</th>\n",
       "      <td>3432</td>\n",
       "      <td>Bike in Movie Night | Prospect Park Bandshell</td>\n",
       "      <td>40.662987</td>\n",
       "      <td>-73.976919</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1401</th>\n",
       "      <td>3432</td>\n",
       "      <td>Bike in Movie Night | Prospect Park Bandshell</td>\n",
       "      <td>40.662988</td>\n",
       "      <td>-73.976922</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>174 rows × 9 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      id_x                                           name        lat  \\\n",
       "38     160                        E 37 St & Lexington Ave  40.748195   \n",
       "39     160                        E 37 St & Lexington Ave  40.748192   \n",
       "60     218                    Gallatin Pl & Livingston St  40.690286   \n",
       "61     218                    Gallatin Pl & Livingston St  40.690285   \n",
       "75     233                 Cadman Plaza W & Pierrepont St  40.694757   \n",
       "77     233                 Cadman Plaza W & Pierrepont St  40.694754   \n",
       "88     242                     Flushing Ave & Carlton Ave  40.697882   \n",
       "91     242                     Flushing Ave & Carlton Ave  40.697882   \n",
       "92     243                        Fulton St & Rockwell Pl  40.688151   \n",
       "93     243                        Fulton St & Rockwell Pl  40.688129   \n",
       "104    250                       Lafayette St & Jersey St  40.724560   \n",
       "105    250                       Lafayette St & Jersey St  40.724557   \n",
       "106    250                     Lafayette St & Jersey St N  40.724560   \n",
       "107    250                     Lafayette St & Jersey St N  40.724559   \n",
       "116    255                              NYCBS Depot - SSP  40.646765   \n",
       "117    255                              NYCBS Depot - SSP  40.646766   \n",
       "130    263                       Elizabeth St & Hester St  40.717329   \n",
       "131    263                       Elizabeth St & Hester St  40.717329   \n",
       "144    271                         Ashland Pl & Hanson Pl  40.685276   \n",
       "145    271                         Ashland Pl & Hanson Pl  40.685281   \n",
       "154    279                             Sands St & Gold St  40.699870   \n",
       "159    279                             Sands St & Gold St  40.699870   \n",
       "164    282                             Kent Ave & S 11 St  40.708024   \n",
       "165    282                             Kent Ave & S 11 St  40.708025   \n",
       "172    290                                2 Ave & E 58 St  40.760204   \n",
       "173    290                                2 Ave & E 58 St  40.760206   \n",
       "176    293                          Lafayette St & E 8 St  40.730284   \n",
       "177    293                          Lafayette St & E 8 St  40.730285   \n",
       "178    294                            Washington Square E  40.730497   \n",
       "179    294                            Washington Square E  40.730495   \n",
       "...    ...                                            ...        ...   \n",
       "1053  3229                      Marcy Ave & MacDonough St  40.680620   \n",
       "1054  3230                             Penn Station Valet  40.751282   \n",
       "1055  3230                             Penn Station Valet  40.751279   \n",
       "1062  3234                          E 40 St & Madison Ave  40.751593   \n",
       "1063  3234                          E 40 St & Madison Ave  40.751592   \n",
       "1070  3237                                 21 St & 41 Ave  40.753832   \n",
       "1071  3237                                 21 St & 41 Ave  40.753833   \n",
       "1074  3239                                       Bressler  40.646539   \n",
       "1083  3245                        Kiosk in a box Motivate  40.646677   \n",
       "1084  3246                       Montague St & Clinton St  40.694282   \n",
       "1085  3246                       Montague St & Clinton St  40.694284   \n",
       "1088  3250                              NYCBS Depot - PIT  40.716912   \n",
       "1089  3250                              NYCBS Depot - PIT  40.716913   \n",
       "1092  3253             Bike The Branches - Central Branch  40.672804   \n",
       "1093  3253             Bike The Branches - Central Branch  40.672806   \n",
       "1094  3254                               Soissons Landing  40.692320   \n",
       "1095  3254                               Soissons Landing  40.692319   \n",
       "1100  3257                                 Adventures NYC  40.773769   \n",
       "1101  3257                                 Adventures NYC  40.773771   \n",
       "1110  3264                             E 61 St & Park Ave  40.764207   \n",
       "1111  3264                             E 61 St & Park Ave  40.764210   \n",
       "1112  3265                                 E 2 St & 2 Ave  40.724565   \n",
       "1113  3265                                 E 2 St & 2 Ave  40.724564   \n",
       "1114  3266                      Kiosk in a box Deployment  40.708611   \n",
       "1115  3266                      Kiosk in a box Deployment  40.708609   \n",
       "1138  3291                         Riverside Dr & W 91 St  40.793373   \n",
       "1139  3291                         Riverside Dr & W 91 St  40.793372   \n",
       "1311  3385                               2 Ave & E 105 St  40.789818   \n",
       "1400  3432  Bike in Movie Night | Prospect Park Bandshell  40.662987   \n",
       "1401  3432  Bike in Movie Night | Prospect Park Bandshell  40.662988   \n",
       "\n",
       "            lon  match_id  id_y stationName  latitude  longitude  \n",
       "38   -73.978309       NaN   NaN         NaN       NaN        NaN  \n",
       "39   -73.978310       NaN   NaN         NaN       NaN        NaN  \n",
       "60   -73.987071       NaN   NaN         NaN       NaN        NaN  \n",
       "61   -73.987069       NaN   NaN         NaN       NaN        NaN  \n",
       "75   -73.990522       NaN   NaN         NaN       NaN        NaN  \n",
       "77   -73.990530       NaN   NaN         NaN       NaN        NaN  \n",
       "88   -73.973503       NaN   NaN         NaN       NaN        NaN  \n",
       "91   -73.973503       NaN   NaN         NaN       NaN        NaN  \n",
       "92   -73.979105       NaN   NaN         NaN       NaN        NaN  \n",
       "93   -73.979028       NaN   NaN         NaN       NaN        NaN  \n",
       "104  -73.995651       NaN   NaN         NaN       NaN        NaN  \n",
       "105  -73.995650       NaN   NaN         NaN       NaN        NaN  \n",
       "106  -73.995653       NaN   NaN         NaN       NaN        NaN  \n",
       "107  -73.995649       NaN   NaN         NaN       NaN        NaN  \n",
       "116  -74.016513       NaN   NaN         NaN       NaN        NaN  \n",
       "117  -74.016510       NaN   NaN         NaN       NaN        NaN  \n",
       "130  -73.996356       NaN   NaN         NaN       NaN        NaN  \n",
       "131  -73.996351       NaN   NaN         NaN       NaN        NaN  \n",
       "144  -73.978059       NaN   NaN         NaN       NaN        NaN  \n",
       "145  -73.978057       NaN   NaN         NaN       NaN        NaN  \n",
       "154  -73.982716       NaN   NaN         NaN       NaN        NaN  \n",
       "159  -73.982720       NaN   NaN         NaN       NaN        NaN  \n",
       "164  -73.968367       NaN   NaN         NaN       NaN        NaN  \n",
       "165  -73.968372       NaN   NaN         NaN       NaN        NaN  \n",
       "172  -73.964786       NaN   NaN         NaN       NaN        NaN  \n",
       "173  -73.964780       NaN   NaN         NaN       NaN        NaN  \n",
       "176  -73.990770       NaN   NaN         NaN       NaN        NaN  \n",
       "177  -73.990771       NaN   NaN         NaN       NaN        NaN  \n",
       "178  -73.995719       NaN   NaN         NaN       NaN        NaN  \n",
       "179  -73.995721       NaN   NaN         NaN       NaN        NaN  \n",
       "...         ...       ...   ...         ...       ...        ...  \n",
       "1053 -73.946245       NaN   NaN         NaN       NaN        NaN  \n",
       "1054 -73.996927       NaN   NaN         NaN       NaN        NaN  \n",
       "1055 -73.996926       NaN   NaN         NaN       NaN        NaN  \n",
       "1062 -73.980427       NaN   NaN         NaN       NaN        NaN  \n",
       "1063 -73.980430       NaN   NaN         NaN       NaN        NaN  \n",
       "1070 -73.942681       NaN   NaN         NaN       NaN        NaN  \n",
       "1071 -73.942676       NaN   NaN         NaN       NaN        NaN  \n",
       "1074 -74.016588       NaN   NaN         NaN       NaN        NaN  \n",
       "1083 -74.016298       NaN   NaN         NaN       NaN        NaN  \n",
       "1084 -73.992300       NaN   NaN         NaN       NaN        NaN  \n",
       "1085 -73.992301       NaN   NaN         NaN       NaN        NaN  \n",
       "1088 -73.983843       NaN   NaN         NaN       NaN        NaN  \n",
       "1089 -73.983843       NaN   NaN         NaN       NaN        NaN  \n",
       "1092 -73.968868       NaN   NaN         NaN       NaN        NaN  \n",
       "1093 -73.968864       NaN   NaN         NaN       NaN        NaN  \n",
       "1094 -74.014862       NaN   NaN         NaN       NaN        NaN  \n",
       "1095 -74.014863       NaN   NaN         NaN       NaN        NaN  \n",
       "1100 -73.971169       NaN   NaN         NaN       NaN        NaN  \n",
       "1101 -73.971169       NaN   NaN         NaN       NaN        NaN  \n",
       "1110 -73.969101       NaN   NaN         NaN       NaN        NaN  \n",
       "1111 -73.969101       NaN   NaN         NaN       NaN        NaN  \n",
       "1112 -73.989439       NaN   NaN         NaN       NaN        NaN  \n",
       "1113 -73.989439       NaN   NaN         NaN       NaN        NaN  \n",
       "1114 -73.928507       NaN   NaN         NaN       NaN        NaN  \n",
       "1115 -73.928510       NaN   NaN         NaN       NaN        NaN  \n",
       "1138 -73.976851       NaN   NaN         NaN       NaN        NaN  \n",
       "1139 -73.976853       NaN   NaN         NaN       NaN        NaN  \n",
       "1311 -73.942963       NaN   NaN         NaN       NaN        NaN  \n",
       "1400 -73.976919       NaN   NaN         NaN       NaN        NaN  \n",
       "1401 -73.976922       NaN   NaN         NaN       NaN        NaN  \n",
       "\n",
       "[174 rows x 9 columns]"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "defunct_stations = lookup_table[np.isnan(lookup_table.match_id)]\n",
    "defunct_stations"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "collapsed": false,
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id_x</th>\n",
       "      <th>name</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>38</th>\n",
       "      <td>160</td>\n",
       "      <td>E 37 St &amp; Lexington Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>60</th>\n",
       "      <td>218</td>\n",
       "      <td>Gallatin Pl &amp; Livingston St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75</th>\n",
       "      <td>233</td>\n",
       "      <td>Cadman Plaza W &amp; Pierrepont St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>88</th>\n",
       "      <td>242</td>\n",
       "      <td>Flushing Ave &amp; Carlton Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>92</th>\n",
       "      <td>243</td>\n",
       "      <td>Fulton St &amp; Rockwell Pl</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>104</th>\n",
       "      <td>250</td>\n",
       "      <td>Lafayette St &amp; Jersey St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>106</th>\n",
       "      <td>250</td>\n",
       "      <td>Lafayette St &amp; Jersey St N</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>116</th>\n",
       "      <td>255</td>\n",
       "      <td>NYCBS Depot - SSP</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>130</th>\n",
       "      <td>263</td>\n",
       "      <td>Elizabeth St &amp; Hester St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>144</th>\n",
       "      <td>271</td>\n",
       "      <td>Ashland Pl &amp; Hanson Pl</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>154</th>\n",
       "      <td>279</td>\n",
       "      <td>Sands St &amp; Gold St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>164</th>\n",
       "      <td>282</td>\n",
       "      <td>Kent Ave &amp; S 11 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>172</th>\n",
       "      <td>290</td>\n",
       "      <td>2 Ave &amp; E 58 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>176</th>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>178</th>\n",
       "      <td>294</td>\n",
       "      <td>Washington Square E</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>186</th>\n",
       "      <td>298</td>\n",
       "      <td>3 Ave &amp; Schermerhorn St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>188</th>\n",
       "      <td>300</td>\n",
       "      <td>Shevchenko Pl &amp; E 7 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>189</th>\n",
       "      <td>300</td>\n",
       "      <td>Shevchenko Pl &amp; E 6 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>222</th>\n",
       "      <td>314</td>\n",
       "      <td>Montague St &amp; Clinton St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>230</th>\n",
       "      <td>318</td>\n",
       "      <td>E 43 St &amp; Vanderbilt Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>233</th>\n",
       "      <td>319</td>\n",
       "      <td>Park Pl &amp; Church St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>236</th>\n",
       "      <td>320</td>\n",
       "      <td>Church St &amp; Leonard St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>256</th>\n",
       "      <td>329</td>\n",
       "      <td>Greenwich St &amp; N Moore St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>258</th>\n",
       "      <td>329</td>\n",
       "      <td>Greenwich St &amp; North Moore St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>290</th>\n",
       "      <td>347</td>\n",
       "      <td>W Houston St &amp; Hudson St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>332</th>\n",
       "      <td>367</td>\n",
       "      <td>E 53 St &amp; Lexington Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>342</th>\n",
       "      <td>375</td>\n",
       "      <td>Mercer St &amp; Bleecker St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>343</th>\n",
       "      <td>375</td>\n",
       "      <td>Mercer St &amp; Bleecker St S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>360</th>\n",
       "      <td>384</td>\n",
       "      <td>Fulton St &amp; Waverly Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>400</th>\n",
       "      <td>404</td>\n",
       "      <td>9 Ave &amp; W 14 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>857</th>\n",
       "      <td>3104</td>\n",
       "      <td>KentAve&amp;N7 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>858</th>\n",
       "      <td>3104</td>\n",
       "      <td>Kent Ave &amp; N 7 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>919</th>\n",
       "      <td>3133</td>\n",
       "      <td>E 67 St &amp; Lexington Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>920</th>\n",
       "      <td>3133</td>\n",
       "      <td>E 67 St &amp; Park Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>931</th>\n",
       "      <td>3138</td>\n",
       "      <td>E 77 St &amp; Park Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>953</th>\n",
       "      <td>3149</td>\n",
       "      <td>E 82 St &amp; 2 Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>961</th>\n",
       "      <td>3153</td>\n",
       "      <td>E 71 St &amp; 2 Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>963</th>\n",
       "      <td>3154</td>\n",
       "      <td>E 77 St &amp; 3 Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1017</th>\n",
       "      <td>3181</td>\n",
       "      <td>Soissons Landing</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1019</th>\n",
       "      <td>3182</td>\n",
       "      <td>Yankee Ferry Terminal</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1024</th>\n",
       "      <td>3186</td>\n",
       "      <td>Grove St PATH</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1038</th>\n",
       "      <td>3219</td>\n",
       "      <td>NYCBS Depot - STY</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1043</th>\n",
       "      <td>3222</td>\n",
       "      <td>Hanson Pl &amp; St Felix St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1052</th>\n",
       "      <td>3229</td>\n",
       "      <td>Marcy Ave &amp; MacDonough St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1054</th>\n",
       "      <td>3230</td>\n",
       "      <td>Penn Station Valet</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1062</th>\n",
       "      <td>3234</td>\n",
       "      <td>E 40 St &amp; Madison Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1070</th>\n",
       "      <td>3237</td>\n",
       "      <td>21 St &amp; 41 Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1074</th>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1083</th>\n",
       "      <td>3245</td>\n",
       "      <td>Kiosk in a box Motivate</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1084</th>\n",
       "      <td>3246</td>\n",
       "      <td>Montague St &amp; Clinton St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1088</th>\n",
       "      <td>3250</td>\n",
       "      <td>NYCBS Depot - PIT</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1092</th>\n",
       "      <td>3253</td>\n",
       "      <td>Bike The Branches - Central Branch</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1094</th>\n",
       "      <td>3254</td>\n",
       "      <td>Soissons Landing</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1100</th>\n",
       "      <td>3257</td>\n",
       "      <td>Adventures NYC</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1110</th>\n",
       "      <td>3264</td>\n",
       "      <td>E 61 St &amp; Park Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1112</th>\n",
       "      <td>3265</td>\n",
       "      <td>E 2 St &amp; 2 Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1114</th>\n",
       "      <td>3266</td>\n",
       "      <td>Kiosk in a box Deployment</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1138</th>\n",
       "      <td>3291</td>\n",
       "      <td>Riverside Dr &amp; W 91 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1311</th>\n",
       "      <td>3385</td>\n",
       "      <td>2 Ave &amp; E 105 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1400</th>\n",
       "      <td>3432</td>\n",
       "      <td>Bike in Movie Night | Prospect Park Bandshell</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>90 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      id_x                                           name\n",
       "38     160                        E 37 St & Lexington Ave\n",
       "60     218                    Gallatin Pl & Livingston St\n",
       "75     233                 Cadman Plaza W & Pierrepont St\n",
       "88     242                     Flushing Ave & Carlton Ave\n",
       "92     243                        Fulton St & Rockwell Pl\n",
       "104    250                       Lafayette St & Jersey St\n",
       "106    250                     Lafayette St & Jersey St N\n",
       "116    255                              NYCBS Depot - SSP\n",
       "130    263                       Elizabeth St & Hester St\n",
       "144    271                         Ashland Pl & Hanson Pl\n",
       "154    279                             Sands St & Gold St\n",
       "164    282                             Kent Ave & S 11 St\n",
       "172    290                                2 Ave & E 58 St\n",
       "176    293                          Lafayette St & E 8 St\n",
       "178    294                            Washington Square E\n",
       "186    298                        3 Ave & Schermerhorn St\n",
       "188    300                         Shevchenko Pl & E 7 St\n",
       "189    300                         Shevchenko Pl & E 6 St\n",
       "222    314                       Montague St & Clinton St\n",
       "230    318                       E 43 St & Vanderbilt Ave\n",
       "233    319                            Park Pl & Church St\n",
       "236    320                         Church St & Leonard St\n",
       "256    329                      Greenwich St & N Moore St\n",
       "258    329                  Greenwich St & North Moore St\n",
       "290    347                       W Houston St & Hudson St\n",
       "332    367                        E 53 St & Lexington Ave\n",
       "342    375                        Mercer St & Bleecker St\n",
       "343    375                      Mercer St & Bleecker St S\n",
       "360    384                        Fulton St & Waverly Ave\n",
       "400    404                                9 Ave & W 14 St\n",
       "...    ...                                            ...\n",
       "857   3104                                  KentAve&N7 St\n",
       "858   3104                              Kent Ave & N 7 St\n",
       "919   3133                        E 67 St & Lexington Ave\n",
       "920   3133                             E 67 St & Park Ave\n",
       "931   3138                             E 77 St & Park Ave\n",
       "953   3149                                E 82 St & 2 Ave\n",
       "961   3153                                E 71 St & 2 Ave\n",
       "963   3154                                E 77 St & 3 Ave\n",
       "1017  3181                               Soissons Landing\n",
       "1019  3182                          Yankee Ferry Terminal\n",
       "1024  3186                                  Grove St PATH\n",
       "1038  3219                              NYCBS Depot - STY\n",
       "1043  3222                        Hanson Pl & St Felix St\n",
       "1052  3229                      Marcy Ave & MacDonough St\n",
       "1054  3230                             Penn Station Valet\n",
       "1062  3234                          E 40 St & Madison Ave\n",
       "1070  3237                                 21 St & 41 Ave\n",
       "1074  3239                                       Bressler\n",
       "1083  3245                        Kiosk in a box Motivate\n",
       "1084  3246                       Montague St & Clinton St\n",
       "1088  3250                              NYCBS Depot - PIT\n",
       "1092  3253             Bike The Branches - Central Branch\n",
       "1094  3254                               Soissons Landing\n",
       "1100  3257                                 Adventures NYC\n",
       "1110  3264                             E 61 St & Park Ave\n",
       "1112  3265                                 E 2 St & 2 Ave\n",
       "1114  3266                      Kiosk in a box Deployment\n",
       "1138  3291                         Riverside Dr & W 91 St\n",
       "1311  3385                               2 Ave & E 105 St\n",
       "1400  3432  Bike in Movie Night | Prospect Park Bandshell\n",
       "\n",
       "[90 rows x 2 columns]"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "defunct_stations = defunct_stations[['id_x', 'name']].drop_duplicates()\n",
    "defunct_stations"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "collapsed": false,
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>trip_duration</th>\n",
       "      <th>start_time</th>\n",
       "      <th>stop_time</th>\n",
       "      <th>start_station_id</th>\n",
       "      <th>start_station_name</th>\n",
       "      <th>start_station_latitude</th>\n",
       "      <th>start_station_longitude</th>\n",
       "      <th>end_station_id</th>\n",
       "      <th>end_station_name</th>\n",
       "      <th>end_station_latitude</th>\n",
       "      <th>end_station_longitude</th>\n",
       "      <th>bike_id</th>\n",
       "      <th>user_type</th>\n",
       "      <th>birth_year</th>\n",
       "      <th>gender</th>\n",
       "      <th>id_x</th>\n",
       "      <th>name</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>178</td>\n",
       "      <td>2013-07-01 00:01:04</td>\n",
       "      <td>2013-07-01 00:04:02</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "      <td>40.730286</td>\n",
       "      <td>-73.990768</td>\n",
       "      <td>237</td>\n",
       "      <td>E 11 St &amp; 2 Ave</td>\n",
       "      <td>40.730473</td>\n",
       "      <td>-73.986725</td>\n",
       "      <td>14548</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1980.0</td>\n",
       "      <td>2</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>550</td>\n",
       "      <td>2013-07-01 00:01:59</td>\n",
       "      <td>2013-07-01 00:11:09</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "      <td>40.730286</td>\n",
       "      <td>-73.990768</td>\n",
       "      <td>394</td>\n",
       "      <td>E 9 St &amp; Avenue C</td>\n",
       "      <td>40.725212</td>\n",
       "      <td>-73.977684</td>\n",
       "      <td>16746</td>\n",
       "      <td>Customer</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>615</td>\n",
       "      <td>2013-07-01 05:48:21</td>\n",
       "      <td>2013-07-01 05:58:36</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "      <td>40.730286</td>\n",
       "      <td>-73.990768</td>\n",
       "      <td>507</td>\n",
       "      <td>E 25 St &amp; 2 Ave</td>\n",
       "      <td>40.739124</td>\n",
       "      <td>-73.979736</td>\n",
       "      <td>19080</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1984.0</td>\n",
       "      <td>2</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>307</td>\n",
       "      <td>2013-07-01 06:47:47</td>\n",
       "      <td>2013-07-01 06:52:54</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "      <td>40.730286</td>\n",
       "      <td>-73.990768</td>\n",
       "      <td>445</td>\n",
       "      <td>E 10 St &amp; Avenue A</td>\n",
       "      <td>40.727409</td>\n",
       "      <td>-73.981422</td>\n",
       "      <td>16105</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1973.0</td>\n",
       "      <td>1</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>387</td>\n",
       "      <td>2013-07-01 07:11:46</td>\n",
       "      <td>2013-07-01 07:18:13</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "      <td>40.730286</td>\n",
       "      <td>-73.990768</td>\n",
       "      <td>497</td>\n",
       "      <td>E 17 St &amp; Broadway</td>\n",
       "      <td>40.737049</td>\n",
       "      <td>-73.990089</td>\n",
       "      <td>15952</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1954.0</td>\n",
       "      <td>1</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>481</td>\n",
       "      <td>2013-07-01 07:13:30</td>\n",
       "      <td>2013-07-01 07:21:31</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "      <td>40.730286</td>\n",
       "      <td>-73.990768</td>\n",
       "      <td>469</td>\n",
       "      <td>Broadway &amp; W 53 St</td>\n",
       "      <td>40.763439</td>\n",
       "      <td>-73.982681</td>\n",
       "      <td>16108</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1968.0</td>\n",
       "      <td>1</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>915</td>\n",
       "      <td>2013-07-01 07:42:55</td>\n",
       "      <td>2013-07-01 07:58:10</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "      <td>40.730286</td>\n",
       "      <td>-73.990768</td>\n",
       "      <td>456</td>\n",
       "      <td>E 53 St &amp; Madison Ave</td>\n",
       "      <td>40.759712</td>\n",
       "      <td>-73.974022</td>\n",
       "      <td>18485</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1983.0</td>\n",
       "      <td>1</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>332</td>\n",
       "      <td>2013-07-01 07:53:56</td>\n",
       "      <td>2013-07-01 07:59:28</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "      <td>40.730286</td>\n",
       "      <td>-73.990768</td>\n",
       "      <td>380</td>\n",
       "      <td>W 4 St &amp; 7 Ave S</td>\n",
       "      <td>40.734013</td>\n",
       "      <td>-74.002937</td>\n",
       "      <td>19540</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1983.0</td>\n",
       "      <td>1</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>687</td>\n",
       "      <td>2013-07-01 07:53:59</td>\n",
       "      <td>2013-07-01 08:05:26</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "      <td>40.730286</td>\n",
       "      <td>-73.990768</td>\n",
       "      <td>519</td>\n",
       "      <td>Pershing Square N</td>\n",
       "      <td>40.751884</td>\n",
       "      <td>-73.977699</td>\n",
       "      <td>16270</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1981.0</td>\n",
       "      <td>1</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>472</td>\n",
       "      <td>2013-07-01 07:58:52</td>\n",
       "      <td>2013-07-01 08:06:44</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "      <td>40.730286</td>\n",
       "      <td>-73.990768</td>\n",
       "      <td>383</td>\n",
       "      <td>Greenwich Ave &amp; Charles St</td>\n",
       "      <td>40.735237</td>\n",
       "      <td>-74.000275</td>\n",
       "      <td>15830</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1989.0</td>\n",
       "      <td>2</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>201</td>\n",
       "      <td>2013-07-01 08:03:14</td>\n",
       "      <td>2013-07-01 08:06:35</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "      <td>40.730286</td>\n",
       "      <td>-73.990768</td>\n",
       "      <td>445</td>\n",
       "      <td>E 10 St &amp; Avenue A</td>\n",
       "      <td>40.727409</td>\n",
       "      <td>-73.981422</td>\n",
       "      <td>17172</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1983.0</td>\n",
       "      <td>1</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>1473</td>\n",
       "      <td>2013-07-01 08:07:14</td>\n",
       "      <td>2013-07-01 08:31:47</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "      <td>40.730286</td>\n",
       "      <td>-73.990768</td>\n",
       "      <td>484</td>\n",
       "      <td>W 44 St &amp; 5 Ave</td>\n",
       "      <td>40.755001</td>\n",
       "      <td>-73.980141</td>\n",
       "      <td>18883</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1979.0</td>\n",
       "      <td>1</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>1368</td>\n",
       "      <td>2013-07-01 08:09:13</td>\n",
       "      <td>2013-07-01 08:32:01</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "      <td>40.730286</td>\n",
       "      <td>-73.990768</td>\n",
       "      <td>522</td>\n",
       "      <td>E 51 St &amp; Lexington Ave</td>\n",
       "      <td>40.757149</td>\n",
       "      <td>-73.972076</td>\n",
       "      <td>16236</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1961.0</td>\n",
       "      <td>2</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>507</td>\n",
       "      <td>2013-07-01 08:20:27</td>\n",
       "      <td>2013-07-01 08:28:54</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "      <td>40.730286</td>\n",
       "      <td>-73.990768</td>\n",
       "      <td>151</td>\n",
       "      <td>Cleveland Pl &amp; Spring St</td>\n",
       "      <td>40.721817</td>\n",
       "      <td>-73.997200</td>\n",
       "      <td>17838</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1985.0</td>\n",
       "      <td>2</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>470</td>\n",
       "      <td>2013-07-01 08:22:13</td>\n",
       "      <td>2013-07-01 08:30:03</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "      <td>40.730286</td>\n",
       "      <td>-73.990768</td>\n",
       "      <td>546</td>\n",
       "      <td>E 30 St &amp; Park Ave S</td>\n",
       "      <td>40.744450</td>\n",
       "      <td>-73.983032</td>\n",
       "      <td>18607</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1985.0</td>\n",
       "      <td>1</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>673</td>\n",
       "      <td>2013-07-01 08:23:45</td>\n",
       "      <td>2013-07-01 08:34:58</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "      <td>40.730286</td>\n",
       "      <td>-73.990768</td>\n",
       "      <td>546</td>\n",
       "      <td>E 30 St &amp; Park Ave S</td>\n",
       "      <td>40.744450</td>\n",
       "      <td>-73.983032</td>\n",
       "      <td>18849</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1981.0</td>\n",
       "      <td>2</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>460</td>\n",
       "      <td>2013-07-01 08:25:19</td>\n",
       "      <td>2013-07-01 08:32:59</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "      <td>40.730286</td>\n",
       "      <td>-73.990768</td>\n",
       "      <td>377</td>\n",
       "      <td>6 Ave &amp; Canal St</td>\n",
       "      <td>40.722439</td>\n",
       "      <td>-74.005661</td>\n",
       "      <td>17104</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1970.0</td>\n",
       "      <td>1</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>558</td>\n",
       "      <td>2013-07-01 08:30:25</td>\n",
       "      <td>2013-07-01 08:39:43</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "      <td>40.730286</td>\n",
       "      <td>-73.990768</td>\n",
       "      <td>320</td>\n",
       "      <td>Church St &amp; Leonard St</td>\n",
       "      <td>40.717442</td>\n",
       "      <td>-74.005836</td>\n",
       "      <td>18092</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1976.0</td>\n",
       "      <td>1</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>458</td>\n",
       "      <td>2013-07-01 08:37:16</td>\n",
       "      <td>2013-07-01 08:44:54</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "      <td>40.730286</td>\n",
       "      <td>-73.990768</td>\n",
       "      <td>445</td>\n",
       "      <td>E 10 St &amp; Avenue A</td>\n",
       "      <td>40.727409</td>\n",
       "      <td>-73.981422</td>\n",
       "      <td>19981</td>\n",
       "      <td>Customer</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>1119</td>\n",
       "      <td>2013-07-01 08:44:37</td>\n",
       "      <td>2013-07-01 09:03:16</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "      <td>40.730286</td>\n",
       "      <td>-73.990768</td>\n",
       "      <td>330</td>\n",
       "      <td>Reade St &amp; Broadway</td>\n",
       "      <td>40.714504</td>\n",
       "      <td>-74.005630</td>\n",
       "      <td>17955</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1973.0</td>\n",
       "      <td>1</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>453</td>\n",
       "      <td>2013-07-01 08:50:18</td>\n",
       "      <td>2013-07-01 08:57:51</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "      <td>40.730286</td>\n",
       "      <td>-73.990768</td>\n",
       "      <td>323</td>\n",
       "      <td>Lawrence St &amp; Willoughby St</td>\n",
       "      <td>40.692360</td>\n",
       "      <td>-73.986320</td>\n",
       "      <td>15215</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1974.0</td>\n",
       "      <td>2</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>453</td>\n",
       "      <td>2013-07-01 08:50:39</td>\n",
       "      <td>2013-07-01 08:58:12</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "      <td>40.730286</td>\n",
       "      <td>-73.990768</td>\n",
       "      <td>151</td>\n",
       "      <td>Cleveland Pl &amp; Spring St</td>\n",
       "      <td>40.721817</td>\n",
       "      <td>-73.997200</td>\n",
       "      <td>18613</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1953.0</td>\n",
       "      <td>2</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>1055</td>\n",
       "      <td>2013-07-01 09:02:12</td>\n",
       "      <td>2013-07-01 09:19:47</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "      <td>40.730286</td>\n",
       "      <td>-73.990768</td>\n",
       "      <td>360</td>\n",
       "      <td>William St &amp; Pine St</td>\n",
       "      <td>40.707180</td>\n",
       "      <td>-74.008873</td>\n",
       "      <td>19020</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1986.0</td>\n",
       "      <td>1</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>235</td>\n",
       "      <td>2013-07-01 09:03:56</td>\n",
       "      <td>2013-07-01 09:07:51</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "      <td>40.730286</td>\n",
       "      <td>-73.990768</td>\n",
       "      <td>445</td>\n",
       "      <td>E 10 St &amp; Avenue A</td>\n",
       "      <td>40.727409</td>\n",
       "      <td>-73.981422</td>\n",
       "      <td>16587</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1981.0</td>\n",
       "      <td>1</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>813</td>\n",
       "      <td>2013-07-01 09:06:01</td>\n",
       "      <td>2013-07-01 09:19:34</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "      <td>40.730286</td>\n",
       "      <td>-73.990768</td>\n",
       "      <td>79</td>\n",
       "      <td>Franklin St &amp; W Broadway</td>\n",
       "      <td>40.719116</td>\n",
       "      <td>-74.006668</td>\n",
       "      <td>14943</td>\n",
       "      <td>Customer</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>488</td>\n",
       "      <td>2013-07-01 09:16:12</td>\n",
       "      <td>2013-07-01 09:24:20</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "      <td>40.730286</td>\n",
       "      <td>-73.990768</td>\n",
       "      <td>410</td>\n",
       "      <td>Suffolk St &amp; Stanton St</td>\n",
       "      <td>40.720665</td>\n",
       "      <td>-73.985176</td>\n",
       "      <td>16821</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1983.0</td>\n",
       "      <td>2</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>663</td>\n",
       "      <td>2013-07-01 09:20:18</td>\n",
       "      <td>2013-07-01 09:31:21</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "      <td>40.730286</td>\n",
       "      <td>-73.990768</td>\n",
       "      <td>419</td>\n",
       "      <td>Carlton Ave &amp; Park Ave</td>\n",
       "      <td>40.695808</td>\n",
       "      <td>-73.973557</td>\n",
       "      <td>20289</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1969.0</td>\n",
       "      <td>1</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>582</td>\n",
       "      <td>2013-07-01 09:27:02</td>\n",
       "      <td>2013-07-01 09:36:44</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "      <td>40.730286</td>\n",
       "      <td>-73.990768</td>\n",
       "      <td>377</td>\n",
       "      <td>6 Ave &amp; Canal St</td>\n",
       "      <td>40.722439</td>\n",
       "      <td>-74.005661</td>\n",
       "      <td>15740</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1954.0</td>\n",
       "      <td>2</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>369</td>\n",
       "      <td>2013-07-01 09:34:34</td>\n",
       "      <td>2013-07-01 09:40:43</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "      <td>40.730286</td>\n",
       "      <td>-73.990768</td>\n",
       "      <td>419</td>\n",
       "      <td>Carlton Ave &amp; Park Ave</td>\n",
       "      <td>40.695808</td>\n",
       "      <td>-73.973557</td>\n",
       "      <td>17653</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1985.0</td>\n",
       "      <td>2</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>1443</td>\n",
       "      <td>2013-07-01 09:37:06</td>\n",
       "      <td>2013-07-01 10:01:09</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "      <td>40.730286</td>\n",
       "      <td>-73.990768</td>\n",
       "      <td>363</td>\n",
       "      <td>West Thames St</td>\n",
       "      <td>40.708347</td>\n",
       "      <td>-74.017136</td>\n",
       "      <td>17753</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1963.0</td>\n",
       "      <td>2</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>819</th>\n",
       "      <td>849</td>\n",
       "      <td>2016-12-30 17:23:53</td>\n",
       "      <td>2016-12-30 17:38:03</td>\n",
       "      <td>2021</td>\n",
       "      <td>W 45 St &amp; 8 Ave</td>\n",
       "      <td>40.759293</td>\n",
       "      <td>-73.988594</td>\n",
       "      <td>2017</td>\n",
       "      <td>E 43 St &amp; 2 Ave</td>\n",
       "      <td>40.750225</td>\n",
       "      <td>-73.971214</td>\n",
       "      <td>21425</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1971.0</td>\n",
       "      <td>1</td>\n",
       "      <td>2017</td>\n",
       "      <td>E 43 St &amp; 2 Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>820</th>\n",
       "      <td>176</td>\n",
       "      <td>2016-12-30 18:31:55</td>\n",
       "      <td>2016-12-30 18:34:51</td>\n",
       "      <td>516</td>\n",
       "      <td>E 47 St &amp; 1 Ave</td>\n",
       "      <td>40.752068</td>\n",
       "      <td>-73.967842</td>\n",
       "      <td>2017</td>\n",
       "      <td>E 43 St &amp; 2 Ave</td>\n",
       "      <td>40.750225</td>\n",
       "      <td>-73.971214</td>\n",
       "      <td>18189</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1947.0</td>\n",
       "      <td>1</td>\n",
       "      <td>2017</td>\n",
       "      <td>E 43 St &amp; 2 Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>821</th>\n",
       "      <td>542</td>\n",
       "      <td>2016-12-30 18:53:13</td>\n",
       "      <td>2016-12-30 19:02:16</td>\n",
       "      <td>3134</td>\n",
       "      <td>3 Ave &amp; E 62 St</td>\n",
       "      <td>40.763126</td>\n",
       "      <td>-73.965271</td>\n",
       "      <td>2017</td>\n",
       "      <td>E 43 St &amp; 2 Ave</td>\n",
       "      <td>40.750225</td>\n",
       "      <td>-73.971214</td>\n",
       "      <td>26070</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1984.0</td>\n",
       "      <td>1</td>\n",
       "      <td>2017</td>\n",
       "      <td>E 43 St &amp; 2 Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>822</th>\n",
       "      <td>644</td>\n",
       "      <td>2016-12-30 20:12:49</td>\n",
       "      <td>2016-12-30 20:23:33</td>\n",
       "      <td>507</td>\n",
       "      <td>E 25 St &amp; 2 Ave</td>\n",
       "      <td>40.739124</td>\n",
       "      <td>-73.979736</td>\n",
       "      <td>2017</td>\n",
       "      <td>E 43 St &amp; 2 Ave</td>\n",
       "      <td>40.750225</td>\n",
       "      <td>-73.971214</td>\n",
       "      <td>18769</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1979.0</td>\n",
       "      <td>1</td>\n",
       "      <td>2017</td>\n",
       "      <td>E 43 St &amp; 2 Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>823</th>\n",
       "      <td>447</td>\n",
       "      <td>2016-12-30 20:15:16</td>\n",
       "      <td>2016-12-30 20:22:43</td>\n",
       "      <td>520</td>\n",
       "      <td>W 52 St &amp; 5 Ave</td>\n",
       "      <td>40.759922</td>\n",
       "      <td>-73.976486</td>\n",
       "      <td>2017</td>\n",
       "      <td>E 43 St &amp; 2 Ave</td>\n",
       "      <td>40.750225</td>\n",
       "      <td>-73.971214</td>\n",
       "      <td>15298</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1993.0</td>\n",
       "      <td>1</td>\n",
       "      <td>2017</td>\n",
       "      <td>E 43 St &amp; 2 Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>824</th>\n",
       "      <td>631</td>\n",
       "      <td>2016-12-30 20:36:26</td>\n",
       "      <td>2016-12-30 20:46:58</td>\n",
       "      <td>3264</td>\n",
       "      <td>E 61 St &amp; Park Ave</td>\n",
       "      <td>40.764210</td>\n",
       "      <td>-73.969101</td>\n",
       "      <td>2017</td>\n",
       "      <td>E 43 St &amp; 2 Ave</td>\n",
       "      <td>40.750225</td>\n",
       "      <td>-73.971214</td>\n",
       "      <td>25940</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1975.0</td>\n",
       "      <td>1</td>\n",
       "      <td>2017</td>\n",
       "      <td>E 43 St &amp; 2 Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>825</th>\n",
       "      <td>555</td>\n",
       "      <td>2016-12-30 20:38:28</td>\n",
       "      <td>2016-12-30 20:47:43</td>\n",
       "      <td>520</td>\n",
       "      <td>W 52 St &amp; 5 Ave</td>\n",
       "      <td>40.759922</td>\n",
       "      <td>-73.976486</td>\n",
       "      <td>2017</td>\n",
       "      <td>E 43 St &amp; 2 Ave</td>\n",
       "      <td>40.750225</td>\n",
       "      <td>-73.971214</td>\n",
       "      <td>26498</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1981.0</td>\n",
       "      <td>2</td>\n",
       "      <td>2017</td>\n",
       "      <td>E 43 St &amp; 2 Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>826</th>\n",
       "      <td>599</td>\n",
       "      <td>2016-12-30 20:52:42</td>\n",
       "      <td>2016-12-30 21:02:41</td>\n",
       "      <td>476</td>\n",
       "      <td>E 31 St &amp; 3 Ave</td>\n",
       "      <td>40.743942</td>\n",
       "      <td>-73.979660</td>\n",
       "      <td>2017</td>\n",
       "      <td>E 43 St &amp; 2 Ave</td>\n",
       "      <td>40.750225</td>\n",
       "      <td>-73.971214</td>\n",
       "      <td>19728</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1956.0</td>\n",
       "      <td>1</td>\n",
       "      <td>2017</td>\n",
       "      <td>E 43 St &amp; 2 Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>827</th>\n",
       "      <td>675</td>\n",
       "      <td>2016-12-30 20:52:45</td>\n",
       "      <td>2016-12-30 21:04:01</td>\n",
       "      <td>476</td>\n",
       "      <td>E 31 St &amp; 3 Ave</td>\n",
       "      <td>40.743942</td>\n",
       "      <td>-73.979660</td>\n",
       "      <td>2017</td>\n",
       "      <td>E 43 St &amp; 2 Ave</td>\n",
       "      <td>40.750225</td>\n",
       "      <td>-73.971214</td>\n",
       "      <td>23888</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1956.0</td>\n",
       "      <td>2</td>\n",
       "      <td>2017</td>\n",
       "      <td>E 43 St &amp; 2 Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>828</th>\n",
       "      <td>658</td>\n",
       "      <td>2016-12-30 23:59:36</td>\n",
       "      <td>2016-12-31 00:10:35</td>\n",
       "      <td>497</td>\n",
       "      <td>E 17 St &amp; Broadway</td>\n",
       "      <td>40.737049</td>\n",
       "      <td>-73.990089</td>\n",
       "      <td>2017</td>\n",
       "      <td>E 43 St &amp; 2 Ave</td>\n",
       "      <td>40.750225</td>\n",
       "      <td>-73.971214</td>\n",
       "      <td>22829</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1988.0</td>\n",
       "      <td>1</td>\n",
       "      <td>2017</td>\n",
       "      <td>E 43 St &amp; 2 Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>829</th>\n",
       "      <td>1301</td>\n",
       "      <td>2016-12-31 07:07:37</td>\n",
       "      <td>2016-12-31 07:29:18</td>\n",
       "      <td>422</td>\n",
       "      <td>W 59 St &amp; 10 Ave</td>\n",
       "      <td>40.770512</td>\n",
       "      <td>-73.988037</td>\n",
       "      <td>2017</td>\n",
       "      <td>E 43 St &amp; 2 Ave</td>\n",
       "      <td>40.750225</td>\n",
       "      <td>-73.971214</td>\n",
       "      <td>21634</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1988.0</td>\n",
       "      <td>1</td>\n",
       "      <td>2017</td>\n",
       "      <td>E 43 St &amp; 2 Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>830</th>\n",
       "      <td>605</td>\n",
       "      <td>2016-12-31 09:59:15</td>\n",
       "      <td>2016-12-31 10:09:21</td>\n",
       "      <td>537</td>\n",
       "      <td>Lexington Ave &amp; E 24 St</td>\n",
       "      <td>40.740257</td>\n",
       "      <td>-73.984093</td>\n",
       "      <td>2017</td>\n",
       "      <td>E 43 St &amp; 2 Ave</td>\n",
       "      <td>40.750225</td>\n",
       "      <td>-73.971214</td>\n",
       "      <td>14816</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1986.0</td>\n",
       "      <td>1</td>\n",
       "      <td>2017</td>\n",
       "      <td>E 43 St &amp; 2 Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>831</th>\n",
       "      <td>356</td>\n",
       "      <td>2016-12-31 18:31:10</td>\n",
       "      <td>2016-12-31 18:37:07</td>\n",
       "      <td>305</td>\n",
       "      <td>E 58 St &amp; 3 Ave</td>\n",
       "      <td>40.760956</td>\n",
       "      <td>-73.967247</td>\n",
       "      <td>2017</td>\n",
       "      <td>E 43 St &amp; 2 Ave</td>\n",
       "      <td>40.750225</td>\n",
       "      <td>-73.971214</td>\n",
       "      <td>16863</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1986.0</td>\n",
       "      <td>1</td>\n",
       "      <td>2017</td>\n",
       "      <td>E 43 St &amp; 2 Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>832</th>\n",
       "      <td>320</td>\n",
       "      <td>2016-12-31 18:49:12</td>\n",
       "      <td>2016-12-31 18:54:33</td>\n",
       "      <td>454</td>\n",
       "      <td>E 51 St &amp; 1 Ave</td>\n",
       "      <td>40.754559</td>\n",
       "      <td>-73.965927</td>\n",
       "      <td>2017</td>\n",
       "      <td>E 43 St &amp; 2 Ave</td>\n",
       "      <td>40.750225</td>\n",
       "      <td>-73.971214</td>\n",
       "      <td>25544</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1948.0</td>\n",
       "      <td>1</td>\n",
       "      <td>2017</td>\n",
       "      <td>E 43 St &amp; 2 Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>833</th>\n",
       "      <td>292</td>\n",
       "      <td>2016-12-29 10:46:47</td>\n",
       "      <td>2016-12-29 10:51:40</td>\n",
       "      <td>432</td>\n",
       "      <td>E 7 St &amp; Avenue A</td>\n",
       "      <td>40.726219</td>\n",
       "      <td>-73.983795</td>\n",
       "      <td>3219</td>\n",
       "      <td>NYCBS Depot - STY</td>\n",
       "      <td>40.729195</td>\n",
       "      <td>-73.976654</td>\n",
       "      <td>17981</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1991.0</td>\n",
       "      <td>1</td>\n",
       "      <td>3219</td>\n",
       "      <td>NYCBS Depot - STY</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>834</th>\n",
       "      <td>843</td>\n",
       "      <td>2016-12-29 18:48:21</td>\n",
       "      <td>2016-12-29 19:02:25</td>\n",
       "      <td>2010</td>\n",
       "      <td>Grand St &amp; Greene St</td>\n",
       "      <td>40.721653</td>\n",
       "      <td>-74.002350</td>\n",
       "      <td>3219</td>\n",
       "      <td>NYCBS Depot - STY</td>\n",
       "      <td>40.729195</td>\n",
       "      <td>-73.976654</td>\n",
       "      <td>19636</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1986.0</td>\n",
       "      <td>1</td>\n",
       "      <td>3219</td>\n",
       "      <td>NYCBS Depot - STY</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>835</th>\n",
       "      <td>489</td>\n",
       "      <td>2016-12-30 11:14:24</td>\n",
       "      <td>2016-12-30 11:22:33</td>\n",
       "      <td>475</td>\n",
       "      <td>E 16 St &amp; Irving Pl</td>\n",
       "      <td>40.735241</td>\n",
       "      <td>-73.987587</td>\n",
       "      <td>3219</td>\n",
       "      <td>NYCBS Depot - STY</td>\n",
       "      <td>40.729195</td>\n",
       "      <td>-73.976654</td>\n",
       "      <td>25244</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1961.0</td>\n",
       "      <td>1</td>\n",
       "      <td>3219</td>\n",
       "      <td>NYCBS Depot - STY</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>836</th>\n",
       "      <td>425</td>\n",
       "      <td>2016-12-30 14:47:24</td>\n",
       "      <td>2016-12-30 14:54:30</td>\n",
       "      <td>285</td>\n",
       "      <td>Broadway &amp; E 14 St</td>\n",
       "      <td>40.734547</td>\n",
       "      <td>-73.990738</td>\n",
       "      <td>3219</td>\n",
       "      <td>NYCBS Depot - STY</td>\n",
       "      <td>40.729195</td>\n",
       "      <td>-73.976654</td>\n",
       "      <td>25347</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1992.0</td>\n",
       "      <td>1</td>\n",
       "      <td>3219</td>\n",
       "      <td>NYCBS Depot - STY</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>837</th>\n",
       "      <td>10118</td>\n",
       "      <td>2016-12-30 17:34:29</td>\n",
       "      <td>2016-12-30 20:23:07</td>\n",
       "      <td>307</td>\n",
       "      <td>Canal St &amp; Rutgers St</td>\n",
       "      <td>40.714275</td>\n",
       "      <td>-73.989899</td>\n",
       "      <td>3219</td>\n",
       "      <td>NYCBS Depot - STY</td>\n",
       "      <td>40.729195</td>\n",
       "      <td>-73.976654</td>\n",
       "      <td>19385</td>\n",
       "      <td>Customer</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>3219</td>\n",
       "      <td>NYCBS Depot - STY</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>838</th>\n",
       "      <td>364</td>\n",
       "      <td>2016-12-30 18:41:52</td>\n",
       "      <td>2016-12-30 18:47:57</td>\n",
       "      <td>504</td>\n",
       "      <td>1 Ave &amp; E 16 St</td>\n",
       "      <td>40.732220</td>\n",
       "      <td>-73.981659</td>\n",
       "      <td>3219</td>\n",
       "      <td>NYCBS Depot - STY</td>\n",
       "      <td>40.729195</td>\n",
       "      <td>-73.976654</td>\n",
       "      <td>21322</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1992.0</td>\n",
       "      <td>1</td>\n",
       "      <td>3219</td>\n",
       "      <td>NYCBS Depot - STY</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>846</th>\n",
       "      <td>774</td>\n",
       "      <td>2016-12-29 16:04:17</td>\n",
       "      <td>2016-12-29 16:17:12</td>\n",
       "      <td>500</td>\n",
       "      <td>Broadway &amp; W 51 St</td>\n",
       "      <td>40.762287</td>\n",
       "      <td>-73.983360</td>\n",
       "      <td>3017</td>\n",
       "      <td>NYCBS Depot - FAR</td>\n",
       "      <td>40.751484</td>\n",
       "      <td>-73.996765</td>\n",
       "      <td>25002</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1988.0</td>\n",
       "      <td>1</td>\n",
       "      <td>3017</td>\n",
       "      <td>NYCBS Depot - FAR</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>847</th>\n",
       "      <td>1767</td>\n",
       "      <td>2016-12-29 19:31:28</td>\n",
       "      <td>2016-12-29 20:00:55</td>\n",
       "      <td>3345</td>\n",
       "      <td>Madison Ave &amp; E 99 St</td>\n",
       "      <td>40.789486</td>\n",
       "      <td>-73.952431</td>\n",
       "      <td>3237</td>\n",
       "      <td>21 St &amp; 41 Ave</td>\n",
       "      <td>40.753834</td>\n",
       "      <td>-73.942680</td>\n",
       "      <td>26371</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1963.0</td>\n",
       "      <td>1</td>\n",
       "      <td>3237</td>\n",
       "      <td>21 St &amp; 41 Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>848</th>\n",
       "      <td>896</td>\n",
       "      <td>2016-12-30 13:26:43</td>\n",
       "      <td>2016-12-30 13:41:39</td>\n",
       "      <td>3113</td>\n",
       "      <td>Greenpoint Ave &amp; Manhattan Ave</td>\n",
       "      <td>40.730259</td>\n",
       "      <td>-73.953941</td>\n",
       "      <td>3237</td>\n",
       "      <td>21 St &amp; 41 Ave</td>\n",
       "      <td>40.753834</td>\n",
       "      <td>-73.942680</td>\n",
       "      <td>25186</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1978.0</td>\n",
       "      <td>1</td>\n",
       "      <td>3237</td>\n",
       "      <td>21 St &amp; 41 Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>849</th>\n",
       "      <td>253</td>\n",
       "      <td>2016-12-30 13:44:19</td>\n",
       "      <td>2016-12-30 13:48:32</td>\n",
       "      <td>3126</td>\n",
       "      <td>44 Dr &amp; Jackson Ave</td>\n",
       "      <td>40.747181</td>\n",
       "      <td>-73.943260</td>\n",
       "      <td>3237</td>\n",
       "      <td>21 St &amp; 41 Ave</td>\n",
       "      <td>40.753834</td>\n",
       "      <td>-73.942680</td>\n",
       "      <td>26703</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1947.0</td>\n",
       "      <td>1</td>\n",
       "      <td>3237</td>\n",
       "      <td>21 St &amp; 41 Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>850</th>\n",
       "      <td>1754</td>\n",
       "      <td>2016-12-30 14:37:57</td>\n",
       "      <td>2016-12-30 15:07:11</td>\n",
       "      <td>402</td>\n",
       "      <td>Broadway &amp; E 22 St</td>\n",
       "      <td>40.740345</td>\n",
       "      <td>-73.989548</td>\n",
       "      <td>3237</td>\n",
       "      <td>21 St &amp; 41 Ave</td>\n",
       "      <td>40.753834</td>\n",
       "      <td>-73.942680</td>\n",
       "      <td>25947</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1963.0</td>\n",
       "      <td>1</td>\n",
       "      <td>3237</td>\n",
       "      <td>21 St &amp; 41 Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>851</th>\n",
       "      <td>363</td>\n",
       "      <td>2016-12-31 01:29:36</td>\n",
       "      <td>2016-12-31 01:35:39</td>\n",
       "      <td>3121</td>\n",
       "      <td>Jackson Ave &amp; 46 Rd</td>\n",
       "      <td>40.745247</td>\n",
       "      <td>-73.947334</td>\n",
       "      <td>3237</td>\n",
       "      <td>21 St &amp; 41 Ave</td>\n",
       "      <td>40.753834</td>\n",
       "      <td>-73.942680</td>\n",
       "      <td>16471</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1959.0</td>\n",
       "      <td>2</td>\n",
       "      <td>3237</td>\n",
       "      <td>21 St &amp; 41 Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>852</th>\n",
       "      <td>1580</td>\n",
       "      <td>2016-12-31 11:26:50</td>\n",
       "      <td>2016-12-31 11:53:11</td>\n",
       "      <td>3119</td>\n",
       "      <td>Vernon Blvd &amp; 50 Ave</td>\n",
       "      <td>40.742329</td>\n",
       "      <td>-73.954117</td>\n",
       "      <td>3237</td>\n",
       "      <td>21 St &amp; 41 Ave</td>\n",
       "      <td>40.753834</td>\n",
       "      <td>-73.942680</td>\n",
       "      <td>26738</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1956.0</td>\n",
       "      <td>2</td>\n",
       "      <td>3237</td>\n",
       "      <td>21 St &amp; 41 Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>853</th>\n",
       "      <td>2590</td>\n",
       "      <td>2016-12-31 13:21:52</td>\n",
       "      <td>2016-12-31 14:05:02</td>\n",
       "      <td>261</td>\n",
       "      <td>Johnson St &amp; Gold St</td>\n",
       "      <td>40.694748</td>\n",
       "      <td>-73.983627</td>\n",
       "      <td>3237</td>\n",
       "      <td>21 St &amp; 41 Ave</td>\n",
       "      <td>40.753834</td>\n",
       "      <td>-73.942680</td>\n",
       "      <td>20954</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1982.0</td>\n",
       "      <td>1</td>\n",
       "      <td>3237</td>\n",
       "      <td>21 St &amp; 41 Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>854</th>\n",
       "      <td>329</td>\n",
       "      <td>2016-12-31 13:27:26</td>\n",
       "      <td>2016-12-31 13:32:55</td>\n",
       "      <td>3126</td>\n",
       "      <td>44 Dr &amp; Jackson Ave</td>\n",
       "      <td>40.747181</td>\n",
       "      <td>-73.943260</td>\n",
       "      <td>3237</td>\n",
       "      <td>21 St &amp; 41 Ave</td>\n",
       "      <td>40.753834</td>\n",
       "      <td>-73.942680</td>\n",
       "      <td>25327</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1996.0</td>\n",
       "      <td>2</td>\n",
       "      <td>3237</td>\n",
       "      <td>21 St &amp; 41 Ave</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>855</th>\n",
       "      <td>1637</td>\n",
       "      <td>2016-12-30 08:38:12</td>\n",
       "      <td>2016-12-30 09:05:30</td>\n",
       "      <td>3319</td>\n",
       "      <td>14 St &amp; 5 Ave</td>\n",
       "      <td>40.666286</td>\n",
       "      <td>-73.988953</td>\n",
       "      <td>255</td>\n",
       "      <td>NYCBS Depot - SSP</td>\n",
       "      <td>40.646767</td>\n",
       "      <td>-74.016510</td>\n",
       "      <td>24953</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1988.0</td>\n",
       "      <td>1</td>\n",
       "      <td>255</td>\n",
       "      <td>NYCBS Depot - SSP</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5521461 rows × 17 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     trip_duration          start_time           stop_time  start_station_id  \\\n",
       "0              178 2013-07-01 00:01:04 2013-07-01 00:04:02               293   \n",
       "1              550 2013-07-01 00:01:59 2013-07-01 00:11:09               293   \n",
       "2              615 2013-07-01 05:48:21 2013-07-01 05:58:36               293   \n",
       "3              307 2013-07-01 06:47:47 2013-07-01 06:52:54               293   \n",
       "4              387 2013-07-01 07:11:46 2013-07-01 07:18:13               293   \n",
       "5              481 2013-07-01 07:13:30 2013-07-01 07:21:31               293   \n",
       "6              915 2013-07-01 07:42:55 2013-07-01 07:58:10               293   \n",
       "7              332 2013-07-01 07:53:56 2013-07-01 07:59:28               293   \n",
       "8              687 2013-07-01 07:53:59 2013-07-01 08:05:26               293   \n",
       "9              472 2013-07-01 07:58:52 2013-07-01 08:06:44               293   \n",
       "10             201 2013-07-01 08:03:14 2013-07-01 08:06:35               293   \n",
       "11            1473 2013-07-01 08:07:14 2013-07-01 08:31:47               293   \n",
       "12            1368 2013-07-01 08:09:13 2013-07-01 08:32:01               293   \n",
       "13             507 2013-07-01 08:20:27 2013-07-01 08:28:54               293   \n",
       "14             470 2013-07-01 08:22:13 2013-07-01 08:30:03               293   \n",
       "15             673 2013-07-01 08:23:45 2013-07-01 08:34:58               293   \n",
       "16             460 2013-07-01 08:25:19 2013-07-01 08:32:59               293   \n",
       "17             558 2013-07-01 08:30:25 2013-07-01 08:39:43               293   \n",
       "18             458 2013-07-01 08:37:16 2013-07-01 08:44:54               293   \n",
       "19            1119 2013-07-01 08:44:37 2013-07-01 09:03:16               293   \n",
       "20             453 2013-07-01 08:50:18 2013-07-01 08:57:51               293   \n",
       "21             453 2013-07-01 08:50:39 2013-07-01 08:58:12               293   \n",
       "22            1055 2013-07-01 09:02:12 2013-07-01 09:19:47               293   \n",
       "23             235 2013-07-01 09:03:56 2013-07-01 09:07:51               293   \n",
       "24             813 2013-07-01 09:06:01 2013-07-01 09:19:34               293   \n",
       "25             488 2013-07-01 09:16:12 2013-07-01 09:24:20               293   \n",
       "26             663 2013-07-01 09:20:18 2013-07-01 09:31:21               293   \n",
       "27             582 2013-07-01 09:27:02 2013-07-01 09:36:44               293   \n",
       "28             369 2013-07-01 09:34:34 2013-07-01 09:40:43               293   \n",
       "29            1443 2013-07-01 09:37:06 2013-07-01 10:01:09               293   \n",
       "..             ...                 ...                 ...               ...   \n",
       "819            849 2016-12-30 17:23:53 2016-12-30 17:38:03              2021   \n",
       "820            176 2016-12-30 18:31:55 2016-12-30 18:34:51               516   \n",
       "821            542 2016-12-30 18:53:13 2016-12-30 19:02:16              3134   \n",
       "822            644 2016-12-30 20:12:49 2016-12-30 20:23:33               507   \n",
       "823            447 2016-12-30 20:15:16 2016-12-30 20:22:43               520   \n",
       "824            631 2016-12-30 20:36:26 2016-12-30 20:46:58              3264   \n",
       "825            555 2016-12-30 20:38:28 2016-12-30 20:47:43               520   \n",
       "826            599 2016-12-30 20:52:42 2016-12-30 21:02:41               476   \n",
       "827            675 2016-12-30 20:52:45 2016-12-30 21:04:01               476   \n",
       "828            658 2016-12-30 23:59:36 2016-12-31 00:10:35               497   \n",
       "829           1301 2016-12-31 07:07:37 2016-12-31 07:29:18               422   \n",
       "830            605 2016-12-31 09:59:15 2016-12-31 10:09:21               537   \n",
       "831            356 2016-12-31 18:31:10 2016-12-31 18:37:07               305   \n",
       "832            320 2016-12-31 18:49:12 2016-12-31 18:54:33               454   \n",
       "833            292 2016-12-29 10:46:47 2016-12-29 10:51:40               432   \n",
       "834            843 2016-12-29 18:48:21 2016-12-29 19:02:25              2010   \n",
       "835            489 2016-12-30 11:14:24 2016-12-30 11:22:33               475   \n",
       "836            425 2016-12-30 14:47:24 2016-12-30 14:54:30               285   \n",
       "837          10118 2016-12-30 17:34:29 2016-12-30 20:23:07               307   \n",
       "838            364 2016-12-30 18:41:52 2016-12-30 18:47:57               504   \n",
       "846            774 2016-12-29 16:04:17 2016-12-29 16:17:12               500   \n",
       "847           1767 2016-12-29 19:31:28 2016-12-29 20:00:55              3345   \n",
       "848            896 2016-12-30 13:26:43 2016-12-30 13:41:39              3113   \n",
       "849            253 2016-12-30 13:44:19 2016-12-30 13:48:32              3126   \n",
       "850           1754 2016-12-30 14:37:57 2016-12-30 15:07:11               402   \n",
       "851            363 2016-12-31 01:29:36 2016-12-31 01:35:39              3121   \n",
       "852           1580 2016-12-31 11:26:50 2016-12-31 11:53:11              3119   \n",
       "853           2590 2016-12-31 13:21:52 2016-12-31 14:05:02               261   \n",
       "854            329 2016-12-31 13:27:26 2016-12-31 13:32:55              3126   \n",
       "855           1637 2016-12-30 08:38:12 2016-12-30 09:05:30              3319   \n",
       "\n",
       "                 start_station_name  start_station_latitude  \\\n",
       "0             Lafayette St & E 8 St               40.730286   \n",
       "1             Lafayette St & E 8 St               40.730286   \n",
       "2             Lafayette St & E 8 St               40.730286   \n",
       "3             Lafayette St & E 8 St               40.730286   \n",
       "4             Lafayette St & E 8 St               40.730286   \n",
       "5             Lafayette St & E 8 St               40.730286   \n",
       "6             Lafayette St & E 8 St               40.730286   \n",
       "7             Lafayette St & E 8 St               40.730286   \n",
       "8             Lafayette St & E 8 St               40.730286   \n",
       "9             Lafayette St & E 8 St               40.730286   \n",
       "10            Lafayette St & E 8 St               40.730286   \n",
       "11            Lafayette St & E 8 St               40.730286   \n",
       "12            Lafayette St & E 8 St               40.730286   \n",
       "13            Lafayette St & E 8 St               40.730286   \n",
       "14            Lafayette St & E 8 St               40.730286   \n",
       "15            Lafayette St & E 8 St               40.730286   \n",
       "16            Lafayette St & E 8 St               40.730286   \n",
       "17            Lafayette St & E 8 St               40.730286   \n",
       "18            Lafayette St & E 8 St               40.730286   \n",
       "19            Lafayette St & E 8 St               40.730286   \n",
       "20            Lafayette St & E 8 St               40.730286   \n",
       "21            Lafayette St & E 8 St               40.730286   \n",
       "22            Lafayette St & E 8 St               40.730286   \n",
       "23            Lafayette St & E 8 St               40.730286   \n",
       "24            Lafayette St & E 8 St               40.730286   \n",
       "25            Lafayette St & E 8 St               40.730286   \n",
       "26            Lafayette St & E 8 St               40.730286   \n",
       "27            Lafayette St & E 8 St               40.730286   \n",
       "28            Lafayette St & E 8 St               40.730286   \n",
       "29            Lafayette St & E 8 St               40.730286   \n",
       "..                              ...                     ...   \n",
       "819                 W 45 St & 8 Ave               40.759293   \n",
       "820                 E 47 St & 1 Ave               40.752068   \n",
       "821                 3 Ave & E 62 St               40.763126   \n",
       "822                 E 25 St & 2 Ave               40.739124   \n",
       "823                 W 52 St & 5 Ave               40.759922   \n",
       "824              E 61 St & Park Ave               40.764210   \n",
       "825                 W 52 St & 5 Ave               40.759922   \n",
       "826                 E 31 St & 3 Ave               40.743942   \n",
       "827                 E 31 St & 3 Ave               40.743942   \n",
       "828              E 17 St & Broadway               40.737049   \n",
       "829                W 59 St & 10 Ave               40.770512   \n",
       "830         Lexington Ave & E 24 St               40.740257   \n",
       "831                 E 58 St & 3 Ave               40.760956   \n",
       "832                 E 51 St & 1 Ave               40.754559   \n",
       "833               E 7 St & Avenue A               40.726219   \n",
       "834            Grand St & Greene St               40.721653   \n",
       "835             E 16 St & Irving Pl               40.735241   \n",
       "836              Broadway & E 14 St               40.734547   \n",
       "837           Canal St & Rutgers St               40.714275   \n",
       "838                 1 Ave & E 16 St               40.732220   \n",
       "846              Broadway & W 51 St               40.762287   \n",
       "847           Madison Ave & E 99 St               40.789486   \n",
       "848  Greenpoint Ave & Manhattan Ave               40.730259   \n",
       "849             44 Dr & Jackson Ave               40.747181   \n",
       "850              Broadway & E 22 St               40.740345   \n",
       "851             Jackson Ave & 46 Rd               40.745247   \n",
       "852            Vernon Blvd & 50 Ave               40.742329   \n",
       "853            Johnson St & Gold St               40.694748   \n",
       "854             44 Dr & Jackson Ave               40.747181   \n",
       "855                   14 St & 5 Ave               40.666286   \n",
       "\n",
       "     start_station_longitude  end_station_id             end_station_name  \\\n",
       "0                 -73.990768             237              E 11 St & 2 Ave   \n",
       "1                 -73.990768             394            E 9 St & Avenue C   \n",
       "2                 -73.990768             507              E 25 St & 2 Ave   \n",
       "3                 -73.990768             445           E 10 St & Avenue A   \n",
       "4                 -73.990768             497           E 17 St & Broadway   \n",
       "5                 -73.990768             469           Broadway & W 53 St   \n",
       "6                 -73.990768             456        E 53 St & Madison Ave   \n",
       "7                 -73.990768             380             W 4 St & 7 Ave S   \n",
       "8                 -73.990768             519            Pershing Square N   \n",
       "9                 -73.990768             383   Greenwich Ave & Charles St   \n",
       "10                -73.990768             445           E 10 St & Avenue A   \n",
       "11                -73.990768             484              W 44 St & 5 Ave   \n",
       "12                -73.990768             522      E 51 St & Lexington Ave   \n",
       "13                -73.990768             151     Cleveland Pl & Spring St   \n",
       "14                -73.990768             546         E 30 St & Park Ave S   \n",
       "15                -73.990768             546         E 30 St & Park Ave S   \n",
       "16                -73.990768             377             6 Ave & Canal St   \n",
       "17                -73.990768             320       Church St & Leonard St   \n",
       "18                -73.990768             445           E 10 St & Avenue A   \n",
       "19                -73.990768             330          Reade St & Broadway   \n",
       "20                -73.990768             323  Lawrence St & Willoughby St   \n",
       "21                -73.990768             151     Cleveland Pl & Spring St   \n",
       "22                -73.990768             360         William St & Pine St   \n",
       "23                -73.990768             445           E 10 St & Avenue A   \n",
       "24                -73.990768              79     Franklin St & W Broadway   \n",
       "25                -73.990768             410      Suffolk St & Stanton St   \n",
       "26                -73.990768             419       Carlton Ave & Park Ave   \n",
       "27                -73.990768             377             6 Ave & Canal St   \n",
       "28                -73.990768             419       Carlton Ave & Park Ave   \n",
       "29                -73.990768             363               West Thames St   \n",
       "..                       ...             ...                          ...   \n",
       "819               -73.988594            2017              E 43 St & 2 Ave   \n",
       "820               -73.967842            2017              E 43 St & 2 Ave   \n",
       "821               -73.965271            2017              E 43 St & 2 Ave   \n",
       "822               -73.979736            2017              E 43 St & 2 Ave   \n",
       "823               -73.976486            2017              E 43 St & 2 Ave   \n",
       "824               -73.969101            2017              E 43 St & 2 Ave   \n",
       "825               -73.976486            2017              E 43 St & 2 Ave   \n",
       "826               -73.979660            2017              E 43 St & 2 Ave   \n",
       "827               -73.979660            2017              E 43 St & 2 Ave   \n",
       "828               -73.990089            2017              E 43 St & 2 Ave   \n",
       "829               -73.988037            2017              E 43 St & 2 Ave   \n",
       "830               -73.984093            2017              E 43 St & 2 Ave   \n",
       "831               -73.967247            2017              E 43 St & 2 Ave   \n",
       "832               -73.965927            2017              E 43 St & 2 Ave   \n",
       "833               -73.983795            3219            NYCBS Depot - STY   \n",
       "834               -74.002350            3219            NYCBS Depot - STY   \n",
       "835               -73.987587            3219            NYCBS Depot - STY   \n",
       "836               -73.990738            3219            NYCBS Depot - STY   \n",
       "837               -73.989899            3219            NYCBS Depot - STY   \n",
       "838               -73.981659            3219            NYCBS Depot - STY   \n",
       "846               -73.983360            3017            NYCBS Depot - FAR   \n",
       "847               -73.952431            3237               21 St & 41 Ave   \n",
       "848               -73.953941            3237               21 St & 41 Ave   \n",
       "849               -73.943260            3237               21 St & 41 Ave   \n",
       "850               -73.989548            3237               21 St & 41 Ave   \n",
       "851               -73.947334            3237               21 St & 41 Ave   \n",
       "852               -73.954117            3237               21 St & 41 Ave   \n",
       "853               -73.983627            3237               21 St & 41 Ave   \n",
       "854               -73.943260            3237               21 St & 41 Ave   \n",
       "855               -73.988953             255            NYCBS Depot - SSP   \n",
       "\n",
       "     end_station_latitude  end_station_longitude  bike_id   user_type  \\\n",
       "0               40.730473             -73.986725    14548  Subscriber   \n",
       "1               40.725212             -73.977684    16746    Customer   \n",
       "2               40.739124             -73.979736    19080  Subscriber   \n",
       "3               40.727409             -73.981422    16105  Subscriber   \n",
       "4               40.737049             -73.990089    15952  Subscriber   \n",
       "5               40.763439             -73.982681    16108  Subscriber   \n",
       "6               40.759712             -73.974022    18485  Subscriber   \n",
       "7               40.734013             -74.002937    19540  Subscriber   \n",
       "8               40.751884             -73.977699    16270  Subscriber   \n",
       "9               40.735237             -74.000275    15830  Subscriber   \n",
       "10              40.727409             -73.981422    17172  Subscriber   \n",
       "11              40.755001             -73.980141    18883  Subscriber   \n",
       "12              40.757149             -73.972076    16236  Subscriber   \n",
       "13              40.721817             -73.997200    17838  Subscriber   \n",
       "14              40.744450             -73.983032    18607  Subscriber   \n",
       "15              40.744450             -73.983032    18849  Subscriber   \n",
       "16              40.722439             -74.005661    17104  Subscriber   \n",
       "17              40.717442             -74.005836    18092  Subscriber   \n",
       "18              40.727409             -73.981422    19981    Customer   \n",
       "19              40.714504             -74.005630    17955  Subscriber   \n",
       "20              40.692360             -73.986320    15215  Subscriber   \n",
       "21              40.721817             -73.997200    18613  Subscriber   \n",
       "22              40.707180             -74.008873    19020  Subscriber   \n",
       "23              40.727409             -73.981422    16587  Subscriber   \n",
       "24              40.719116             -74.006668    14943    Customer   \n",
       "25              40.720665             -73.985176    16821  Subscriber   \n",
       "26              40.695808             -73.973557    20289  Subscriber   \n",
       "27              40.722439             -74.005661    15740  Subscriber   \n",
       "28              40.695808             -73.973557    17653  Subscriber   \n",
       "29              40.708347             -74.017136    17753  Subscriber   \n",
       "..                    ...                    ...      ...         ...   \n",
       "819             40.750225             -73.971214    21425  Subscriber   \n",
       "820             40.750225             -73.971214    18189  Subscriber   \n",
       "821             40.750225             -73.971214    26070  Subscriber   \n",
       "822             40.750225             -73.971214    18769  Subscriber   \n",
       "823             40.750225             -73.971214    15298  Subscriber   \n",
       "824             40.750225             -73.971214    25940  Subscriber   \n",
       "825             40.750225             -73.971214    26498  Subscriber   \n",
       "826             40.750225             -73.971214    19728  Subscriber   \n",
       "827             40.750225             -73.971214    23888  Subscriber   \n",
       "828             40.750225             -73.971214    22829  Subscriber   \n",
       "829             40.750225             -73.971214    21634  Subscriber   \n",
       "830             40.750225             -73.971214    14816  Subscriber   \n",
       "831             40.750225             -73.971214    16863  Subscriber   \n",
       "832             40.750225             -73.971214    25544  Subscriber   \n",
       "833             40.729195             -73.976654    17981  Subscriber   \n",
       "834             40.729195             -73.976654    19636  Subscriber   \n",
       "835             40.729195             -73.976654    25244  Subscriber   \n",
       "836             40.729195             -73.976654    25347  Subscriber   \n",
       "837             40.729195             -73.976654    19385    Customer   \n",
       "838             40.729195             -73.976654    21322  Subscriber   \n",
       "846             40.751484             -73.996765    25002  Subscriber   \n",
       "847             40.753834             -73.942680    26371  Subscriber   \n",
       "848             40.753834             -73.942680    25186  Subscriber   \n",
       "849             40.753834             -73.942680    26703  Subscriber   \n",
       "850             40.753834             -73.942680    25947  Subscriber   \n",
       "851             40.753834             -73.942680    16471  Subscriber   \n",
       "852             40.753834             -73.942680    26738  Subscriber   \n",
       "853             40.753834             -73.942680    20954  Subscriber   \n",
       "854             40.753834             -73.942680    25327  Subscriber   \n",
       "855             40.646767             -74.016510    24953  Subscriber   \n",
       "\n",
       "     birth_year  gender  id_x                   name  \n",
       "0        1980.0       2   293  Lafayette St & E 8 St  \n",
       "1           NaN       0   293  Lafayette St & E 8 St  \n",
       "2        1984.0       2   293  Lafayette St & E 8 St  \n",
       "3        1973.0       1   293  Lafayette St & E 8 St  \n",
       "4        1954.0       1   293  Lafayette St & E 8 St  \n",
       "5        1968.0       1   293  Lafayette St & E 8 St  \n",
       "6        1983.0       1   293  Lafayette St & E 8 St  \n",
       "7        1983.0       1   293  Lafayette St & E 8 St  \n",
       "8        1981.0       1   293  Lafayette St & E 8 St  \n",
       "9        1989.0       2   293  Lafayette St & E 8 St  \n",
       "10       1983.0       1   293  Lafayette St & E 8 St  \n",
       "11       1979.0       1   293  Lafayette St & E 8 St  \n",
       "12       1961.0       2   293  Lafayette St & E 8 St  \n",
       "13       1985.0       2   293  Lafayette St & E 8 St  \n",
       "14       1985.0       1   293  Lafayette St & E 8 St  \n",
       "15       1981.0       2   293  Lafayette St & E 8 St  \n",
       "16       1970.0       1   293  Lafayette St & E 8 St  \n",
       "17       1976.0       1   293  Lafayette St & E 8 St  \n",
       "18          NaN       0   293  Lafayette St & E 8 St  \n",
       "19       1973.0       1   293  Lafayette St & E 8 St  \n",
       "20       1974.0       2   293  Lafayette St & E 8 St  \n",
       "21       1953.0       2   293  Lafayette St & E 8 St  \n",
       "22       1986.0       1   293  Lafayette St & E 8 St  \n",
       "23       1981.0       1   293  Lafayette St & E 8 St  \n",
       "24          NaN       0   293  Lafayette St & E 8 St  \n",
       "25       1983.0       2   293  Lafayette St & E 8 St  \n",
       "26       1969.0       1   293  Lafayette St & E 8 St  \n",
       "27       1954.0       2   293  Lafayette St & E 8 St  \n",
       "28       1985.0       2   293  Lafayette St & E 8 St  \n",
       "29       1963.0       2   293  Lafayette St & E 8 St  \n",
       "..          ...     ...   ...                    ...  \n",
       "819      1971.0       1  2017        E 43 St & 2 Ave  \n",
       "820      1947.0       1  2017        E 43 St & 2 Ave  \n",
       "821      1984.0       1  2017        E 43 St & 2 Ave  \n",
       "822      1979.0       1  2017        E 43 St & 2 Ave  \n",
       "823      1993.0       1  2017        E 43 St & 2 Ave  \n",
       "824      1975.0       1  2017        E 43 St & 2 Ave  \n",
       "825      1981.0       2  2017        E 43 St & 2 Ave  \n",
       "826      1956.0       1  2017        E 43 St & 2 Ave  \n",
       "827      1956.0       2  2017        E 43 St & 2 Ave  \n",
       "828      1988.0       1  2017        E 43 St & 2 Ave  \n",
       "829      1988.0       1  2017        E 43 St & 2 Ave  \n",
       "830      1986.0       1  2017        E 43 St & 2 Ave  \n",
       "831      1986.0       1  2017        E 43 St & 2 Ave  \n",
       "832      1948.0       1  2017        E 43 St & 2 Ave  \n",
       "833      1991.0       1  3219      NYCBS Depot - STY  \n",
       "834      1986.0       1  3219      NYCBS Depot - STY  \n",
       "835      1961.0       1  3219      NYCBS Depot - STY  \n",
       "836      1992.0       1  3219      NYCBS Depot - STY  \n",
       "837         NaN       0  3219      NYCBS Depot - STY  \n",
       "838      1992.0       1  3219      NYCBS Depot - STY  \n",
       "846      1988.0       1  3017      NYCBS Depot - FAR  \n",
       "847      1963.0       1  3237         21 St & 41 Ave  \n",
       "848      1978.0       1  3237         21 St & 41 Ave  \n",
       "849      1947.0       1  3237         21 St & 41 Ave  \n",
       "850      1963.0       1  3237         21 St & 41 Ave  \n",
       "851      1959.0       2  3237         21 St & 41 Ave  \n",
       "852      1956.0       2  3237         21 St & 41 Ave  \n",
       "853      1982.0       1  3237         21 St & 41 Ave  \n",
       "854      1996.0       2  3237         21 St & 41 Ave  \n",
       "855      1988.0       1   255      NYCBS Depot - SSP  \n",
       "\n",
       "[5521461 rows x 17 columns]"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "defunct_trips_start = df.merge(defunct_stations, left_on=['start_station_id', 'start_station_name'],\n",
    "         right_on=['id_x', 'name'])\n",
    "defunct_trips_end = df.merge(defunct_stations, left_on=['end_station_id', 'end_station_name'],\n",
    "         right_on=['id_x', 'name'])\n",
    "defunct_trips_all = (defunct_trips_start.append(defunct_trips_end).compute().drop_duplicates())\n",
    "defunct_trips_all"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# ^^\n",
    "# Over five million rows that start or end at defunct stations!\n",
    "## We can't drop that many given the total is 36 million!"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>trip_duration</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>start_station_id</th>\n",
       "      <th>start_station_name</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>3423</th>\n",
       "      <th>West Drive &amp; Prospect Park West</th>\n",
       "      <td>49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3329</th>\n",
       "      <th>Degraw St &amp; Smith St</th>\n",
       "      <td>48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3414</th>\n",
       "      <th>Bergen St &amp; Flatbush Ave</th>\n",
       "      <td>47</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3339</th>\n",
       "      <th>Berkeley Pl &amp; 6 Ave</th>\n",
       "      <td>45</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3438</th>\n",
       "      <th>E 76 St &amp; 3 Ave</th>\n",
       "      <td>45</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3363</th>\n",
       "      <th>E 102 St &amp; Park Ave</th>\n",
       "      <td>43</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3404</th>\n",
       "      <th>7 St &amp; 5 Ave</th>\n",
       "      <td>43</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3419</th>\n",
       "      <th>Douglass St &amp; 4 Ave</th>\n",
       "      <td>42</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3355</th>\n",
       "      <th>E 66 St &amp; Madison Ave</th>\n",
       "      <td>42</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3328</th>\n",
       "      <th>W 100 St &amp; Manhattan Ave</th>\n",
       "      <td>40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3316</th>\n",
       "      <th>W 104 St &amp; Amsterdam Ave</th>\n",
       "      <td>39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3366</th>\n",
       "      <th>West End Ave &amp; W 107 St</th>\n",
       "      <td>39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3399</th>\n",
       "      <th>7 St &amp; 3 Ave</th>\n",
       "      <td>38</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3347</th>\n",
       "      <th>Van Brunt St &amp; Wolcott St</th>\n",
       "      <td>38</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3322</th>\n",
       "      <th>12 St &amp; 4 Ave</th>\n",
       "      <td>38</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3343</th>\n",
       "      <th>W 107 St &amp; Columbus Ave</th>\n",
       "      <td>37</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3354</th>\n",
       "      <th>3 St &amp; Prospect Park West</th>\n",
       "      <td>36</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3356</th>\n",
       "      <th>Amsterdam Ave &amp; W 66 St</th>\n",
       "      <td>36</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3310</th>\n",
       "      <th>14 St &amp; 7 Ave</th>\n",
       "      <td>36</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3130</th>\n",
       "      <th>21 St &amp; Queens Plaza North</th>\n",
       "      <td>36</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3319</th>\n",
       "      <th>14 St &amp; 5 Ave</th>\n",
       "      <td>36</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3317</th>\n",
       "      <th>10 St &amp; 5 Ave</th>\n",
       "      <td>35</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3358</th>\n",
       "      <th>Garfield Pl &amp; 8 Ave</th>\n",
       "      <td>34</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3390</th>\n",
       "      <th>E 109 St &amp; 3 Ave</th>\n",
       "      <td>34</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3365</th>\n",
       "      <th>3 St &amp; 7 Ave</th>\n",
       "      <td>33</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3346</th>\n",
       "      <th>Berkeley Pl &amp; 7 Ave</th>\n",
       "      <td>31</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3384</th>\n",
       "      <th>Smith St &amp; 3 St</th>\n",
       "      <td>31</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3250</th>\n",
       "      <th>NYCBS Depot - PIT</th>\n",
       "      <td>31</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3413</th>\n",
       "      <th>Wyckoff St &amp; 3 Ave</th>\n",
       "      <td>30</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3351</th>\n",
       "      <th>E 102 St &amp; 1 Ave</th>\n",
       "      <td>30</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3300</th>\n",
       "      <th>Prospect Park West &amp; 8 St</th>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3370</th>\n",
       "      <th>78 St &amp; 2 Ave</th>\n",
       "      <td>18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3340</th>\n",
       "      <th>Wolcott St &amp; Dwight St</th>\n",
       "      <td>18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3239</th>\n",
       "      <th>Bressler</th>\n",
       "      <td>18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3327</th>\n",
       "      <th>3 Ave &amp; E 100 St</th>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3014</th>\n",
       "      <th>3969.TEMP (Bike The Branches - Central Branch)</th>\n",
       "      <td>16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3338</th>\n",
       "      <th>2 Ave &amp; E 99 St</th>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3398</th>\n",
       "      <th>Smith St &amp; 9 St</th>\n",
       "      <td>14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3391</th>\n",
       "      <th>E 106 St &amp; 1 Ave</th>\n",
       "      <td>14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3348</th>\n",
       "      <th>Coffey St &amp; Conover St</th>\n",
       "      <td>14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3017</th>\n",
       "      <th>NYCBS Depot - FAR</th>\n",
       "      <td>13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3040</th>\n",
       "      <th>SSP Tech Workshop</th>\n",
       "      <td>12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3440</th>\n",
       "      <th>Fulton St &amp; Adams St</th>\n",
       "      <td>12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3387</th>\n",
       "      <th>E 106 St &amp; Madison Ave</th>\n",
       "      <td>12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3036</th>\n",
       "      <th>8D OPS 01</th>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3342</th>\n",
       "      <th>Pioneer St &amp; Richards St</th>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3379</th>\n",
       "      <th>E 103 St &amp; Lexington Ave</th>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3405</th>\n",
       "      <th>5 St &amp; 6 Ave</th>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3266</th>\n",
       "      <th>Kiosk in a box Deployment</th>\n",
       "      <td>7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3393</th>\n",
       "      <th>Richards St &amp; Delavan St</th>\n",
       "      <td>7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3333</th>\n",
       "      <th>Columbia St &amp; Lorraine St</th>\n",
       "      <td>7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3395</th>\n",
       "      <th>Henry St &amp; W 9 St</th>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3424</th>\n",
       "      <th>E 106 St &amp; Lexington Ave</th>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3394</th>\n",
       "      <th>Columbia St &amp; W 9 St</th>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3330</th>\n",
       "      <th>Henry St &amp; Bay St</th>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3326</th>\n",
       "      <th>Clinton St &amp; Centre St</th>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3252</th>\n",
       "      <th>Bike The Branches - Red Hook Branch</th>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3371</th>\n",
       "      <th>4 Ave &amp; 2 St</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3385</th>\n",
       "      <th>2 Ave &amp; E 105 St</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3240</th>\n",
       "      <th>NYCBS Depot BAL - DYR</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>77 rows × 1 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                                 trip_duration\n",
       "start_station_id start_station_name                                           \n",
       "3423             West Drive & Prospect Park West                            49\n",
       "3329             Degraw St & Smith St                                       48\n",
       "3414             Bergen St & Flatbush Ave                                   47\n",
       "3339             Berkeley Pl & 6 Ave                                        45\n",
       "3438             E 76 St & 3 Ave                                            45\n",
       "3363             E 102 St & Park Ave                                        43\n",
       "3404             7 St & 5 Ave                                               43\n",
       "3419             Douglass St & 4 Ave                                        42\n",
       "3355             E 66 St & Madison Ave                                      42\n",
       "3328             W 100 St & Manhattan Ave                                   40\n",
       "3316             W 104 St & Amsterdam Ave                                   39\n",
       "3366             West End Ave & W 107 St                                    39\n",
       "3399             7 St & 3 Ave                                               38\n",
       "3347             Van Brunt St & Wolcott St                                  38\n",
       "3322             12 St & 4 Ave                                              38\n",
       "3343             W 107 St & Columbus Ave                                    37\n",
       "3354             3 St & Prospect Park West                                  36\n",
       "3356             Amsterdam Ave & W 66 St                                    36\n",
       "3310             14 St & 7 Ave                                              36\n",
       "3130             21 St & Queens Plaza North                                 36\n",
       "3319             14 St & 5 Ave                                              36\n",
       "3317             10 St & 5 Ave                                              35\n",
       "3358             Garfield Pl & 8 Ave                                        34\n",
       "3390             E 109 St & 3 Ave                                           34\n",
       "3365             3 St & 7 Ave                                               33\n",
       "3346             Berkeley Pl & 7 Ave                                        31\n",
       "3384             Smith St & 3 St                                            31\n",
       "3250             NYCBS Depot - PIT                                          31\n",
       "3413             Wyckoff St & 3 Ave                                         30\n",
       "3351             E 102 St & 1 Ave                                           30\n",
       "...                                                                        ...\n",
       "3300             Prospect Park West & 8 St                                  19\n",
       "3370             78 St & 2 Ave                                              18\n",
       "3340             Wolcott St & Dwight St                                     18\n",
       "3239             Bressler                                                   18\n",
       "3327             3 Ave & E 100 St                                           17\n",
       "3014             3969.TEMP (Bike The Branches - Central Branch)             16\n",
       "3338             2 Ave & E 99 St                                            15\n",
       "3398             Smith St & 9 St                                            14\n",
       "3391             E 106 St & 1 Ave                                           14\n",
       "3348             Coffey St & Conover St                                     14\n",
       "3017             NYCBS Depot - FAR                                          13\n",
       "3040             SSP Tech Workshop                                          12\n",
       "3440             Fulton St & Adams St                                       12\n",
       "3387             E 106 St & Madison Ave                                     12\n",
       "3036             8D OPS 01                                                  10\n",
       "3342             Pioneer St & Richards St                                   10\n",
       "3379             E 103 St & Lexington Ave                                    9\n",
       "3405             5 St & 6 Ave                                                9\n",
       "3266             Kiosk in a box Deployment                                   7\n",
       "3393             Richards St & Delavan St                                    7\n",
       "3333             Columbia St & Lorraine St                                   7\n",
       "3395             Henry St & W 9 St                                           6\n",
       "3424             E 106 St & Lexington Ave                                    6\n",
       "3394             Columbia St & W 9 St                                        4\n",
       "3330             Henry St & Bay St                                           3\n",
       "3326             Clinton St & Centre St                                      3\n",
       "3252             Bike The Branches - Red Hook Branch                         2\n",
       "3371             4 Ave & 2 St                                                1\n",
       "3385             2 Ave & E 105 St                                            1\n",
       "3240             NYCBS Depot BAL - DYR                                       1\n",
       "\n",
       "[77 rows x 1 columns]"
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "defunct_start_trips_count = defunct_trips_all[['start_station_id', 'start_station_name', 'trip_duration']].groupby(['start_station_id', 'start_station_name']).count().sort_values('trip_duration', \n",
    "                                                                                               ascending=False)\n",
    "bad_ids = defunct_start_trips_count[defunct_start_trips_count.trip_duration < 50].reset_index()[['start_station_id']]\n",
    "defunct_start_trips_count[defunct_start_trips_count.trip_duration < 50]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>trip_duration</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>end_station_id</th>\n",
       "      <th>end_station_name</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>3423</th>\n",
       "      <th>West Drive &amp; Prospect Park West</th>\n",
       "      <td>49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3341</th>\n",
       "      <th>Central Park West &amp; W 102 St</th>\n",
       "      <td>48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3414</th>\n",
       "      <th>Bergen St &amp; Flatbush Ave</th>\n",
       "      <td>47</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3283</th>\n",
       "      <th>W 89 St &amp; Columbus Ave</th>\n",
       "      <td>44</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3404</th>\n",
       "      <th>7 St &amp; 5 Ave</th>\n",
       "      <td>43</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3344</th>\n",
       "      <th>Pioneer St &amp; Van Brunt St</th>\n",
       "      <td>39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3353</th>\n",
       "      <th>Reed St &amp; Van Brunt St</th>\n",
       "      <td>37</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3413</th>\n",
       "      <th>Wyckoff St &amp; 3 Ave</th>\n",
       "      <td>37</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3384</th>\n",
       "      <th>Smith St &amp; 3 St</th>\n",
       "      <td>36</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3407</th>\n",
       "      <th>Union St &amp; Nevins St</th>\n",
       "      <td>36</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3347</th>\n",
       "      <th>Van Brunt St &amp; Wolcott St</th>\n",
       "      <td>35</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3322</th>\n",
       "      <th>12 St &amp; 4 Ave</th>\n",
       "      <td>35</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3356</th>\n",
       "      <th>Amsterdam Ave &amp; W 66 St</th>\n",
       "      <td>34</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3351</th>\n",
       "      <th>E 102 St &amp; 1 Ave</th>\n",
       "      <td>34</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3317</th>\n",
       "      <th>10 St &amp; 5 Ave</th>\n",
       "      <td>33</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3304</th>\n",
       "      <th>6 Ave &amp; 9 St</th>\n",
       "      <td>32</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3438</th>\n",
       "      <th>E 76 St &amp; 3 Ave</th>\n",
       "      <td>31</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3320</th>\n",
       "      <th>Central Park West &amp; W 100 St</th>\n",
       "      <td>30</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3392</th>\n",
       "      <th>Commerce St &amp; Van Brunt St</th>\n",
       "      <td>30</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3319</th>\n",
       "      <th>14 St &amp; 5 Ave</th>\n",
       "      <td>30</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3310</th>\n",
       "      <th>14 St &amp; 7 Ave</th>\n",
       "      <td>30</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3345</th>\n",
       "      <th>Madison Ave &amp; E 99 St</th>\n",
       "      <td>30</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3403</th>\n",
       "      <th>4 Ave &amp; 9 St</th>\n",
       "      <td>27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3316</th>\n",
       "      <th>W 104 St &amp; Amsterdam Ave</th>\n",
       "      <td>27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3363</th>\n",
       "      <th>E 102 St &amp; Park Ave</th>\n",
       "      <td>26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3425</th>\n",
       "      <th>2 Ave  &amp; E 104 St</th>\n",
       "      <td>25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3166</th>\n",
       "      <th>Riverside Dr &amp; W 72 St</th>\n",
       "      <td>24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3434</th>\n",
       "      <th>W 88 St &amp; West End Ave</th>\n",
       "      <td>23</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3343</th>\n",
       "      <th>W 107 St &amp; Columbus Ave</th>\n",
       "      <td>22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3309</th>\n",
       "      <th>E 97 St &amp; 3 Ave</th>\n",
       "      <td>22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3354</th>\n",
       "      <th>3 St &amp; Prospect Park West</th>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3381</th>\n",
       "      <th>3 St &amp; Hoyt St</th>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3313</th>\n",
       "      <th>6 Ave &amp; 12 St</th>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3333</th>\n",
       "      <th>Columbia St &amp; Lorraine St</th>\n",
       "      <td>14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3240</th>\n",
       "      <th>NYCBS Depot BAL - DYR</th>\n",
       "      <td>14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3401</th>\n",
       "      <th>2 Ave &amp; 9 St</th>\n",
       "      <td>12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3326</th>\n",
       "      <th>Clinton St &amp; Centre St</th>\n",
       "      <td>12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3358</th>\n",
       "      <th>Garfield Pl &amp; 8 Ave</th>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3393</th>\n",
       "      <th>Richards St &amp; Delavan St</th>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3036</th>\n",
       "      <th>8D OPS 01</th>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3330</th>\n",
       "      <th>Henry St &amp; Bay St</th>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3327</th>\n",
       "      <th>3 Ave &amp; E 100 St</th>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3424</th>\n",
       "      <th>E 106 St &amp; Lexington Ave</th>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3040</th>\n",
       "      <th>SSP Tech Workshop</th>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3405</th>\n",
       "      <th>5 St &amp; 6 Ave</th>\n",
       "      <td>8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3346</th>\n",
       "      <th>Berkeley Pl &amp; 7 Ave</th>\n",
       "      <td>7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3302</th>\n",
       "      <th>Columbus Ave &amp; W 103 St</th>\n",
       "      <td>7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3252</th>\n",
       "      <th>Bike The Branches - Red Hook Branch</th>\n",
       "      <td>7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3379</th>\n",
       "      <th>E 103 St &amp; Lexington Ave</th>\n",
       "      <td>7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3440</th>\n",
       "      <th>Fulton St &amp; Adams St</th>\n",
       "      <td>7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3266</th>\n",
       "      <th>Kiosk in a box Deployment</th>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3370</th>\n",
       "      <th>78 St &amp; 2 Ave</th>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3186</th>\n",
       "      <th>Grove St PATH</th>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3338</th>\n",
       "      <th>2 Ave &amp; E 99 St</th>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3014</th>\n",
       "      <th>3969.TEMP (Bike The Branches - Central Branch)</th>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3395</th>\n",
       "      <th>Henry St &amp; W 9 St</th>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3385</th>\n",
       "      <th>2 Ave &amp; E 105 St</th>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3394</th>\n",
       "      <th>Columbia St &amp; W 9 St</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3187</th>\n",
       "      <th>Warren St</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3439</th>\n",
       "      <th>Broadway &amp; E 22 St - Valet Scan</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>77 rows × 1 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                               trip_duration\n",
       "end_station_id end_station_name                                             \n",
       "3423           West Drive & Prospect Park West                            49\n",
       "3341           Central Park West & W 102 St                               48\n",
       "3414           Bergen St & Flatbush Ave                                   47\n",
       "3283           W 89 St & Columbus Ave                                     44\n",
       "3404           7 St & 5 Ave                                               43\n",
       "3344           Pioneer St & Van Brunt St                                  39\n",
       "3353           Reed St & Van Brunt St                                     37\n",
       "3413           Wyckoff St & 3 Ave                                         37\n",
       "3384           Smith St & 3 St                                            36\n",
       "3407           Union St & Nevins St                                       36\n",
       "3347           Van Brunt St & Wolcott St                                  35\n",
       "3322           12 St & 4 Ave                                              35\n",
       "3356           Amsterdam Ave & W 66 St                                    34\n",
       "3351           E 102 St & 1 Ave                                           34\n",
       "3317           10 St & 5 Ave                                              33\n",
       "3304           6 Ave & 9 St                                               32\n",
       "3438           E 76 St & 3 Ave                                            31\n",
       "3320           Central Park West & W 100 St                               30\n",
       "3392           Commerce St & Van Brunt St                                 30\n",
       "3319           14 St & 5 Ave                                              30\n",
       "3310           14 St & 7 Ave                                              30\n",
       "3345           Madison Ave & E 99 St                                      30\n",
       "3403           4 Ave & 9 St                                               27\n",
       "3316           W 104 St & Amsterdam Ave                                   27\n",
       "3363           E 102 St & Park Ave                                        26\n",
       "3425           2 Ave  & E 104 St                                          25\n",
       "3166           Riverside Dr & W 72 St                                     24\n",
       "3434           W 88 St & West End Ave                                     23\n",
       "3343           W 107 St & Columbus Ave                                    22\n",
       "3309           E 97 St & 3 Ave                                            22\n",
       "...                                                                      ...\n",
       "3354           3 St & Prospect Park West                                  15\n",
       "3381           3 St & Hoyt St                                             15\n",
       "3313           6 Ave & 12 St                                              15\n",
       "3333           Columbia St & Lorraine St                                  14\n",
       "3240           NYCBS Depot BAL - DYR                                      14\n",
       "3401           2 Ave & 9 St                                               12\n",
       "3326           Clinton St & Centre St                                     12\n",
       "3358           Garfield Pl & 8 Ave                                        11\n",
       "3393           Richards St & Delavan St                                   11\n",
       "3036           8D OPS 01                                                  10\n",
       "3330           Henry St & Bay St                                          10\n",
       "3327           3 Ave & E 100 St                                           10\n",
       "3424           E 106 St & Lexington Ave                                    9\n",
       "3040           SSP Tech Workshop                                           9\n",
       "3405           5 St & 6 Ave                                                8\n",
       "3346           Berkeley Pl & 7 Ave                                         7\n",
       "3302           Columbus Ave & W 103 St                                     7\n",
       "3252           Bike The Branches - Red Hook Branch                         7\n",
       "3379           E 103 St & Lexington Ave                                    7\n",
       "3440           Fulton St & Adams St                                        7\n",
       "3266           Kiosk in a box Deployment                                   6\n",
       "3370           78 St & 2 Ave                                               6\n",
       "3186           Grove St PATH                                               6\n",
       "3338           2 Ave & E 99 St                                             5\n",
       "3014           3969.TEMP (Bike The Branches - Central Branch)              3\n",
       "3395           Henry St & W 9 St                                           3\n",
       "3385           2 Ave & E 105 St                                            2\n",
       "3394           Columbia St & W 9 St                                        1\n",
       "3187           Warren St                                                   1\n",
       "3439           Broadway & E 22 St - Valet Scan                             1\n",
       "\n",
       "[77 rows x 1 columns]"
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "defunct_end_trips_count = defunct_trips_all[[\n",
    "    'end_station_id', 'end_station_name', 'trip_duration']].groupby(\n",
    "    ['end_station_id', 'end_station_name']).count().sort_values('trip_duration', ascending=False)\n",
    "bad_ids_2 = (\n",
    "    defunct_end_trips_count[defunct_end_trips_count.trip_duration < 50].reset_index()\n",
    ")[['end_station_id']]\n",
    "defunct_end_trips_count[defunct_end_trips_count.trip_duration < 50]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {
    "collapsed": false,
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "      <th>6</th>\n",
       "      <th>7</th>\n",
       "      <th>8</th>\n",
       "      <th>9</th>\n",
       "      <th>10</th>\n",
       "      <th>11</th>\n",
       "      <th>12</th>\n",
       "      <th>13</th>\n",
       "      <th>14</th>\n",
       "      <th>15</th>\n",
       "      <th>16</th>\n",
       "      <th>17</th>\n",
       "      <th>18</th>\n",
       "      <th>19</th>\n",
       "      <th>20</th>\n",
       "      <th>21</th>\n",
       "      <th>22</th>\n",
       "      <th>23</th>\n",
       "      <th>24</th>\n",
       "      <th>25</th>\n",
       "      <th>26</th>\n",
       "      <th>27</th>\n",
       "      <th>28</th>\n",
       "      <th>29</th>\n",
       "      <th>30</th>\n",
       "      <th>31</th>\n",
       "      <th>32</th>\n",
       "      <th>33</th>\n",
       "      <th>34</th>\n",
       "      <th>35</th>\n",
       "      <th>36</th>\n",
       "      <th>37</th>\n",
       "      <th>38</th>\n",
       "      <th>39</th>\n",
       "      <th>40</th>\n",
       "      <th>41</th>\n",
       "      <th>42</th>\n",
       "      <th>43</th>\n",
       "      <th>44</th>\n",
       "      <th>45</th>\n",
       "      <th>46</th>\n",
       "      <th>47</th>\n",
       "      <th>48</th>\n",
       "      <th>49</th>\n",
       "      <th>50</th>\n",
       "      <th>51</th>\n",
       "      <th>52</th>\n",
       "      <th>53</th>\n",
       "      <th>54</th>\n",
       "      <th>55</th>\n",
       "      <th>56</th>\n",
       "      <th>57</th>\n",
       "      <th>58</th>\n",
       "      <th>59</th>\n",
       "      <th>60</th>\n",
       "      <th>61</th>\n",
       "      <th>62</th>\n",
       "      <th>63</th>\n",
       "      <th>64</th>\n",
       "      <th>65</th>\n",
       "      <th>66</th>\n",
       "      <th>67</th>\n",
       "      <th>68</th>\n",
       "      <th>69</th>\n",
       "      <th>70</th>\n",
       "      <th>71</th>\n",
       "      <th>72</th>\n",
       "      <th>73</th>\n",
       "      <th>74</th>\n",
       "      <th>75</th>\n",
       "      <th>76</th>\n",
       "      <th>77</th>\n",
       "      <th>78</th>\n",
       "      <th>79</th>\n",
       "      <th>80</th>\n",
       "      <th>81</th>\n",
       "      <th>82</th>\n",
       "      <th>83</th>\n",
       "      <th>84</th>\n",
       "      <th>85</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>id</th>\n",
       "      <td>3014</td>\n",
       "      <td>3017</td>\n",
       "      <td>3036</td>\n",
       "      <td>3040</td>\n",
       "      <td>3130</td>\n",
       "      <td>3166</td>\n",
       "      <td>3186</td>\n",
       "      <td>3187</td>\n",
       "      <td>3239</td>\n",
       "      <td>3240</td>\n",
       "      <td>3250</td>\n",
       "      <td>3252</td>\n",
       "      <td>3266</td>\n",
       "      <td>3283</td>\n",
       "      <td>3297</td>\n",
       "      <td>3300</td>\n",
       "      <td>3302</td>\n",
       "      <td>3304</td>\n",
       "      <td>3306</td>\n",
       "      <td>3309</td>\n",
       "      <td>3310</td>\n",
       "      <td>3313</td>\n",
       "      <td>3316</td>\n",
       "      <td>3317</td>\n",
       "      <td>3319</td>\n",
       "      <td>3320</td>\n",
       "      <td>3322</td>\n",
       "      <td>3326</td>\n",
       "      <td>3327</td>\n",
       "      <td>3328</td>\n",
       "      <td>3329</td>\n",
       "      <td>3330</td>\n",
       "      <td>3332</td>\n",
       "      <td>3333</td>\n",
       "      <td>3338</td>\n",
       "      <td>3339</td>\n",
       "      <td>3340</td>\n",
       "      <td>3341</td>\n",
       "      <td>3342</td>\n",
       "      <td>3343</td>\n",
       "      <td>3344</td>\n",
       "      <td>3345</td>\n",
       "      <td>3346</td>\n",
       "      <td>3347</td>\n",
       "      <td>3348</td>\n",
       "      <td>3351</td>\n",
       "      <td>3353</td>\n",
       "      <td>3354</td>\n",
       "      <td>3355</td>\n",
       "      <td>3356</td>\n",
       "      <td>3358</td>\n",
       "      <td>3363</td>\n",
       "      <td>3365</td>\n",
       "      <td>3366</td>\n",
       "      <td>3370</td>\n",
       "      <td>3371</td>\n",
       "      <td>3379</td>\n",
       "      <td>3381</td>\n",
       "      <td>3384</td>\n",
       "      <td>3385</td>\n",
       "      <td>3387</td>\n",
       "      <td>3390</td>\n",
       "      <td>3391</td>\n",
       "      <td>3392</td>\n",
       "      <td>3393</td>\n",
       "      <td>3394</td>\n",
       "      <td>3395</td>\n",
       "      <td>3398</td>\n",
       "      <td>3399</td>\n",
       "      <td>3401</td>\n",
       "      <td>3403</td>\n",
       "      <td>3404</td>\n",
       "      <td>3405</td>\n",
       "      <td>3407</td>\n",
       "      <td>3413</td>\n",
       "      <td>3414</td>\n",
       "      <td>3419</td>\n",
       "      <td>3421</td>\n",
       "      <td>3423</td>\n",
       "      <td>3424</td>\n",
       "      <td>3425</td>\n",
       "      <td>3432</td>\n",
       "      <td>3434</td>\n",
       "      <td>3438</td>\n",
       "      <td>3439</td>\n",
       "      <td>3440</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "bad_ids.columns =['id']\n",
    "bad_ids_2.columns = ['id']\n",
    "bad_ids = bad_ids.append(bad_ids_2).drop_duplicates().sort_values('id').reset_index(drop=True)\n",
    "from IPython.display import display, HTML \n",
    "display(HTML(bad_ids.T.to_html()))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([3014, 3017, 3036, 3040, 3130, 3166, 3186, 3187, 3239, 3240, 3250,\n",
       "       3252, 3266, 3283, 3297, 3300, 3302, 3304, 3306, 3309, 3310, 3313,\n",
       "       3316, 3317, 3319, 3320, 3322, 3326, 3327, 3328, 3329, 3330, 3332,\n",
       "       3333, 3338, 3339, 3340, 3341, 3342, 3343, 3344, 3345, 3346, 3347,\n",
       "       3348, 3351, 3353, 3354, 3355, 3356, 3358, 3363, 3365, 3366, 3370,\n",
       "       3371, 3379, 3381, 3384, 3385, 3387, 3390, 3391, 3392, 3393, 3394,\n",
       "       3395, 3398, 3399, 3401, 3403, 3404, 3405, 3407, 3413, 3414, 3419,\n",
       "       3421, 3423, 3424, 3425, 3432, 3434, 3438, 3439, 3440])"
      ]
     },
     "execution_count": 73,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bad_ids.id.T.values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "df2 = df.merge(bad_ids, left_on='start_station_id', right_on='id', how='left').merge(\n",
    "    bad_ids, left_on='end_station_id', right_on='id', how='left'\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "df3 = df2[df2.id_x.isnull() & df2.id_y.isnull()]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(36589081,)"
      ]
     },
     "execution_count": 83,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df3.start_station_id.compute().shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(36902025,)"
      ]
     },
     "execution_count": 81,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.start_station_id.compute().shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python [default]",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
